mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
8c7fe471fb
PR-URL: https://github.com/nodejs/node/pull/50492 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
24 lines
404 B
JavaScript
24 lines
404 B
JavaScript
'use strict';
|
|
|
|
const assert = require('assert');
|
|
const common = require('../common.js');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
n: [1e6],
|
|
});
|
|
|
|
function main({ n }) {
|
|
const arr = [];
|
|
for (let i = 0; i < n; ++i) {
|
|
arr.push(performance.now());
|
|
}
|
|
|
|
bench.start();
|
|
for (let i = 0; i < n; i++) {
|
|
arr[i] = performance.now();
|
|
}
|
|
bench.end(n);
|
|
|
|
assert.strictEqual(arr.length, n);
|
|
}
|