Last active
January 29, 2016 21:55
-
-
Save trueadm/a7df3e6129178cc4d60c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var t1 = Inferno.createTemplate(function(key, children) { | |
return { | |
dom: null, | |
static: null, | |
tag: null, | |
key: key, | |
attrs: null, | |
children: children, | |
nextItem: null | |
} | |
}, { | |
dom: null, | |
static: null, | |
tag: 'div', | |
key: null, | |
attrs: null, | |
children: null, | |
nextItem: null | |
}); | |
var t2 = Inferno.createTemplate(function(key) { | |
return { | |
dom: null, | |
static: null, | |
tag: null, | |
key: key, | |
attrs: null, | |
children: key, | |
nextItem: null | |
} | |
}, { | |
dom: null, | |
static: null, | |
tag: 'span', | |
key: null, | |
attrs: null, | |
children: null, | |
nextItem: null | |
}); | |
function renderTree(nodes) { | |
var children = new Array(nodes.length); | |
var i; | |
var n; | |
for (i = 0; i < nodes.length; i++) { | |
n = nodes[i]; | |
if (n.children !== null) { | |
children[i] = t1(n.key, renderTree(n.children)); | |
} else { | |
children[i] = t2(n.key); | |
} | |
} | |
return children; | |
} | |
function BenchmarkImpl(container, a, b) { | |
this.container = container; | |
this.a = a; | |
this.b = b; | |
} | |
BenchmarkImpl.prototype.setUp = function() { | |
}; | |
BenchmarkImpl.prototype.tearDown = function() { | |
Inferno.render(null, this.container); | |
}; | |
BenchmarkImpl.prototype.render = function() { | |
Inferno.render(t1(null, renderTree(this.a)), this.container) | |
}; | |
BenchmarkImpl.prototype.update = function() { | |
Inferno.render(t1(null, renderTree(this.b)), this.container); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment