Created
September 2, 2012 08:20
-
-
Save Satyam/3595837 to your computer and use it in GitHub Desktop.
TreeView Speed test
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
YUI( | |
{gallery: 'gallery-2012.08.29-20-10'} | |
).use('gallery-yui3treeview-ng', function (Y) { | |
'use strict'; | |
var count = 0, | |
makeBranch = function (prefix, depth) { | |
var branch = [], node; | |
count +=1; | |
for (var i = 0; i < 5; i+=1) { | |
node = {label: prefix + '-' + i, collapsed: !!(i % 2)}; | |
if (depth < 3) { | |
node.children = makeBranch(prefix + '-' + i, depth + 1); | |
} | |
branch.push(node); | |
} | |
return branch; | |
}, | |
tree = { | |
startCollapsed: false, | |
children: makeBranch('label',0) | |
}; | |
console.log('node count:', count); | |
window.setTimeout( function () { | |
console.time('TreeView'); | |
var tv = new Y.TreeView(tree); | |
tv.render('#container'); | |
console.timeEnd('TreeView'); | |
},10); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment