GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — node/benchmark/process/next-tick-loop-args.js at main · windwiny/node Expand file tree/ Copy pathnext-tick-loop-args.jsMore file actions 37 lines (34 loc) · 713 Bytes / Copy pathnext-tick-loop-args.jsFile metadata and controls37 lines (34 loc) · 713 Bytes 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 26 27 28 29 30 31 32 33 34 35 36 37 'use strict'; const common = require('../common.js'); const bench = common.createBenchmark(main, { n: [1e4, 2e4, 4e4], loop: [1e2, 2e2], }); function main({ n, loop }) { bench.start(); run(); function run() { let j = 0; function cb() { j++; if (j === n) { loop--; if (loop === 0) { bench.end(n); } else { run(); } } } for (let i = 0; i < n; i++) { if (i % 4 === 0) process.nextTick(cb, i, true, 10, 'test'); else if (i % 3 === 0) process.nextTick(cb, i, true, 10); else if (i % 2 === 0) process.nextTick(cb, i, 20); else process.nextTick(cb, i); } } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |