Created
July 3, 2017 06:15
-
-
Save tomlagier/549c1e49074551d715d8549feb42b6e9 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
let root, nodes, layout, i; | |
for (i = 0; i < 10; i++) { | |
console.time('D3'); | |
root = d3.hierarchy({children: children.map(node=>node.toSmall())}) | |
.sum(node => node.value); | |
layout = d3.pack() | |
.size([d.width, d.width]) | |
.padding(1.5); | |
nodes = layout(root).leaves() | |
nodes.forEach(node => delete node.parent); | |
console.timeEnd('D3'); | |
} | |
for (i = 0; i < 10; i++) { | |
console.time('WASM'); | |
root = new Module.Hierarchy({ | |
size: [d.width, d.width], | |
padding: 1.5 | |
}, { value: 0, children: children.map(node => node.toSmall())}); | |
nodes = root.pack().leaves(); | |
console.timeEnd('WASM'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment