-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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: #10764 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Brian White <[email protected]>
- Loading branch information
1 parent
9fcd842
commit a647d82
Showing
5 changed files
with
65 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters