mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
benchmark: (timers) use destructuring
PR-URL: https://github.com/nodejs/node/pull/18250 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
3e3254a2e7
commit
11d6458fd7
11 files changed
+23
-23
No files matched your search
@@ -6,9 +6,9 @@ const bench = common.createBenchmark(main, {
|
||||
type: ['depth', 'depth1', 'breadth', 'breadth1', 'breadth4', 'clear']
|
||||
});
|
||||
|
||||
function main(conf) {
|
||||
const N = +conf.thousands * 1e3;
|
||||
switch (conf.type) {
|
||||
function main({ thousands, type }) {
|
||||
const N = thousands * 1e3;
|
||||
switch (type) {
|
||||
case 'depth':
|
||||
depth(N);
|
||||
break;
|
||||
|
||||
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
|
||||
millions: [5]
|
||||
});
|
||||
|
||||
function main(conf) {
|
||||
const N = +conf.millions * 1e6;
|
||||
function main({ millions }) {
|
||||
const N = millions * 1e6;
|
||||
|
||||
process.on('exit', function() {
|
||||
bench.end(N / 1e6);
|
||||
|
||||
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
|
||||
millions: [10]
|
||||
});
|
||||
|
||||
function main(conf) {
|
||||
const N = +conf.millions * 1e6;
|
||||
function main({ millions }) {
|
||||
const N = millions * 1e6;
|
||||
|
||||
process.on('exit', function() {
|
||||
bench.end(N / 1e6);
|
||||
|
||||
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
|
||||
millions: [5]
|
||||
});
|
||||
|
||||
function main(conf) {
|
||||
const N = +conf.millions * 1e6;
|
||||
function main({ millions }) {
|
||||
const N = millions * 1e6;
|
||||
|
||||
process.on('exit', function() {
|
||||
bench.end(N / 1e6);
|
||||
|
||||
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
|
||||
thousands: [5000],
|
||||
});
|
||||
|
||||
function main(conf) {
|
||||
const N = +conf.thousands * 1e3;
|
||||
function main({ thousands }) {
|
||||
const N = thousands * 1e3;
|
||||
var n = 0;
|
||||
bench.start();
|
||||
function cb() {
|
||||
|
||||
@@ -6,8 +6,8 @@ const bench = common.createBenchmark(main, {
|
||||
millions: [5],
|
||||
});
|
||||
|
||||
function main(conf) {
|
||||
const iterations = +conf.millions * 1e6;
|
||||
function main({ millions }) {
|
||||
const iterations = millions * 1e6;
|
||||
|
||||
var timer = setTimeout(() => {}, 1);
|
||||
for (var i = 0; i < iterations; i++) {
|
||||
|
||||
@@ -6,8 +6,8 @@ const bench = common.createBenchmark(main, {
|
||||
millions: [1],
|
||||
});
|
||||
|
||||
function main(conf) {
|
||||
const iterations = +conf.millions * 1e6;
|
||||
function main({ millions }) {
|
||||
const iterations = millions * 1e6;
|
||||
|
||||
const timersList = [];
|
||||
for (var i = 0; i < iterations; i++) {
|
||||
|
||||
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
|
||||
thousands: [1],
|
||||
});
|
||||
|
||||
function main(conf) {
|
||||
const N = +conf.thousands * 1e3;
|
||||
function main({ thousands }) {
|
||||
const N = thousands * 1e3;
|
||||
var n = 0;
|
||||
bench.start();
|
||||
setTimeout(cb, 1);
|
||||
|
||||
@@ -5,8 +5,8 @@ const bench = common.createBenchmark(main, {
|
||||
millions: [5],
|
||||
});
|
||||
|
||||
function main(conf) {
|
||||
const iterations = +conf.millions * 1e6;
|
||||
function main({ millions }) {
|
||||
const iterations = millions * 1e6;
|
||||
|
||||
bench.start();
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ const bench = common.createBenchmark(main, {
|
||||
millions: [1],
|
||||
});
|
||||
|
||||
function main(conf) {
|
||||
const iterations = +conf.millions * 1e6;
|
||||
function main({ millions }) {
|
||||
const iterations = millions * 1e6;
|
||||
|
||||
const timersList = [];
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ const bench = common.createBenchmark(main, {
|
||||
millions: [10],
|
||||
});
|
||||
|
||||
function main(conf) {
|
||||
const iterations = +conf.millions * 1e6;
|
||||
function main({ millions }) {
|
||||
const iterations = millions * 1e6;
|
||||
let count = 0;
|
||||
|
||||
// Function tracking on the hidden class in V8 can cause misleading
|
||||
|
||||
Reference in new issue
Block a user