node tests: Add commented-out benchmarks for Dict.

The benchmark is commented out.  It takes only a few
milliseconds to run, so there may be no reason not
to always run it.  It doesn't test correctness, so
it would arguably inflate line coverage, but set/get
are obviously covered elsewhere.
This commit is contained in:
Steve Howell 2019-12-29 13:00:09 +00:00 committed by Tim Abbott
parent 30ad1b6f16
commit 9afad9e054
1 changed files with 21 additions and 0 deletions

View File

@ -171,6 +171,27 @@ run_test('num_items', () => {
assert.equal(d.num_items(), 1);
});
/*
run_test('benchmark', () => {
const d = new Dict();
const n = 5000;
const t1 = new Date().getTime();
_.each(_.range(n), (i) => {
d.set(i, i);
});
_.each(_.range(n), (i) => {
d.get(i, i);
});
const t2 = new Date().getTime();
const elapsed = t2 - t1;
console.log('elapsed (milli)', elapsed);
console.log('per (micro)', 1000 * elapsed / n);
});
*/
run_test('clear', () => {
const d = new Dict();