mirror of https://github.com/zulip/zulip.git
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:
parent
30ad1b6f16
commit
9afad9e054
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue