blob: 7b46bad719a9c331c723b823768010fa0d186a35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
'use strict';
const common = require('../common.js');
const assert = require('assert');
const bench = common.createBenchmark(main, {
n: [1e6],
});
function main({ n }) {
const timersList = [];
for (var i = 0; i < n; i++) {
timersList.push(setTimeout(cb, i + 1));
}
bench.start();
for (var j = 0; j < n + 1; j++) {
clearTimeout(timersList[j]);
}
bench.end(n);
}
function cb() {
assert.fail(`Timer ${this._idleTimeout} should not call callback`);
}
|