Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/perf_hooks/usertiming.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/benchmark/perf_hooks/usertiming.js b/benchmark/perf_hooks/usertiming.js
index ae797351ad7..24a53a11678 100644
--- a/benchmark/perf_hooks/usertiming.js
+++ b/benchmark/perf_hooks/usertiming.js
@@ -8,24 +8,27 @@ const {
} = require('perf_hooks');
const bench = common.createBenchmark(main, {
- n: [1e5]
+ n: [1e5],
+ observe: ['all', 'measure'],
});
function test() {
performance.mark('a');
- setImmediate(() => {
- performance.mark('b');
- performance.measure('a to b', 'a', 'b');
- });
+ performance.mark('b');
+ performance.measure('a to b', 'a', 'b');
}
-function main({ n }) {
+function main({ n, observe }) {
+ const entryTypes = observe === 'all' ?
+ [ 'mark', 'measure' ] :
+ [ observe ];
const obs = new PerformanceObserver(() => {
bench.end(n);
});
- obs.observe({ entryTypes: ['measure'], buffered: true });
+ obs.observe({ entryTypes, buffered: true });
bench.start();
- for (let i = 0; i < n; i++)
+ performance.mark('start');
+ for (let i = 0; i < 1e5; i++)
test();
}