Make the benchmark a little more precise
We special-case identical vnode trees, so it's better that we test both identical and rebuilt trees when benchmarking rendering.
This commit is contained in:
parent
67e1aad944
commit
7f0b7e04dd
1 changed files with 48 additions and 1 deletions
|
|
@ -70,7 +70,7 @@ suite.on("complete", function() {
|
||||||
suite.on("error", console.error.bind(console))
|
suite.on("error", console.error.bind(console))
|
||||||
|
|
||||||
suite.add({
|
suite.add({
|
||||||
name : "rerender without changes",
|
name : "rerender identical vnode",
|
||||||
onStart : function() {
|
onStart : function() {
|
||||||
this.vdom = m("div", {class: "foo bar", "data-foo": "bar", p: 2},
|
this.vdom = m("div", {class: "foo bar", "data-foo": "bar", p: 2},
|
||||||
m("header",
|
m("header",
|
||||||
|
|
@ -119,6 +119,53 @@ suite.add({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
suite.add({
|
||||||
|
name : "rerender same tree",
|
||||||
|
fn : function() {
|
||||||
|
m.render(scratch, m("div", {class: "foo bar", "data-foo": "bar", p: 2},
|
||||||
|
m("header",
|
||||||
|
m("h1", {class: "asdf"}, "a ", "b", " c ", 0, " d"),
|
||||||
|
m("nav",
|
||||||
|
m("a", {href: "/foo"}, "Foo"),
|
||||||
|
m("a", {href: "/bar"}, "Bar")
|
||||||
|
)
|
||||||
|
),
|
||||||
|
m("main",
|
||||||
|
m("form", {onSubmit: function onSubmit() {}},
|
||||||
|
m("input", {type: "checkbox", checked: true}),
|
||||||
|
m("input", {type: "checkbox", checked: false}),
|
||||||
|
m("fieldset",
|
||||||
|
m("label",
|
||||||
|
m("input", {type: "radio", checked: true})
|
||||||
|
),
|
||||||
|
m("label",
|
||||||
|
m("input", {type: "radio"})
|
||||||
|
)
|
||||||
|
),
|
||||||
|
m("button-bar",
|
||||||
|
m("button",
|
||||||
|
{style: "width:10px; height:10px; border:1px solid #FFF;"},
|
||||||
|
"Normal CSS"
|
||||||
|
),
|
||||||
|
m("button",
|
||||||
|
{style: "top:0 ; right: 20"},
|
||||||
|
"Poor CSS"
|
||||||
|
),
|
||||||
|
m("button",
|
||||||
|
{style: "invalid-prop:1;padding:1px;font:12px/1.1 arial,sans-serif;", icon: true},
|
||||||
|
"Poorer CSS"
|
||||||
|
),
|
||||||
|
m("button",
|
||||||
|
{style: {margin: 0, padding: "10px", overflow: "visible"}},
|
||||||
|
"Object CSS"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
suite.add({
|
suite.add({
|
||||||
name : "construct large VDOM tree",
|
name : "construct large VDOM tree",
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue