A small benchmark comparing the performance of various methods of creating an ES6 iterator over a k-ary tree.
$ npm install
$ npm run benchmark
All implementations are stored in ./benchmarks/
. To add a new one, simply create a new file that looks like this:
"use strict";
module.exports = {
name: "Benchmark name",
impl: tree => /* create iterator here */
};
Then in index.js
, add the iterator to the pre_benchmarks like so:
const pre_benchmarks = [
...,
iteratorTest(require('./benchmarks/my_new_benchmark'))
];
It will now be included in the test.
Trees are simply:
function Node(value, children) {
this.value = value;
this.children = children;
};
where children is an array of child nodes.