mirror of https://github.com/lukechilds/node.git
Browse Source
* Add benchmarks for diffing a previous result * Improvements to the documentation, including type annotation * Update the outdated comments in src/node.cc, improve comments in lib/internal/process.js * Check the argument is an Array Tuple with length 2 PR-URL: https://github.com/nodejs/node/pull/10764 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Brian White <mscdex@mscdex.net>v6
Joyee Cheung
8 years ago
5 changed files with 65 additions and 38 deletions
@ -1,18 +1,32 @@ |
|||
'use strict'; |
|||
|
|||
const common = require('../common'); |
|||
const assert = require('assert'); |
|||
|
|||
const bench = common.createBenchmark(main, { |
|||
n: [1e6] |
|||
n: [1e6], |
|||
type: ['raw', 'diff'] |
|||
}); |
|||
|
|||
|
|||
function main(conf) { |
|||
const n = conf.n >>> 0; |
|||
const n = conf.n | 0; |
|||
const hrtime = process.hrtime; |
|||
var noDead = hrtime(); |
|||
var i; |
|||
|
|||
bench.start(); |
|||
for (var i = 0; i < n; i++) { |
|||
process.hrtime(); |
|||
if (conf.type === 'raw') { |
|||
bench.start(); |
|||
for (i = 0; i < n; i++) { |
|||
noDead = hrtime(); |
|||
} |
|||
bench.end(n); |
|||
} else { |
|||
bench.start(); |
|||
for (i = 0; i < n; i++) { |
|||
noDead = hrtime(noDead); |
|||
} |
|||
bench.end(n); |
|||
} |
|||
bench.end(n); |
|||
|
|||
assert.ok(Array.isArray(noDead)); |
|||
} |
|||
|
Loading…
Reference in new issue