Skip to content

Commit

Permalink
bench: track Date.now() as upper bound reference (denoland#9922)
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronO committed Mar 28, 2021
1 parent 00468bc commit 269ea88
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions cli/bench/deno_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ function benchUrlParse() {
});
}

function benchNow() {
benchSync("now", 5e5, () => {
function benchDateNow() {
benchSync("date_now", 5e5, () => {
Date.now();
});
}

function benchPerfNow() {
benchSync("perf_now", 5e5, () => {
performance.now();
});
}
Expand All @@ -46,9 +52,15 @@ function benchReadZero() {
}

function main() {
// v8 builtin that's close to the upper bound non-NOPs
benchDateNow();
// A very lightweight op, that should be highly optimizable
benchPerfNow();
// A common "language feature", that should be fast
// also a decent representation of a non-trivial JSON-op
benchUrlParse();
benchNow();
benchWriteNull();
// IO ops
benchReadZero();
benchWriteNull();
}
main();

0 comments on commit 269ea88

Please sign in to comment.