mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 03:07:54 +01:00
adaef03216
PR-URL: https://github.com/nodejs/node/pull/50074 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
25 lines
457 B
JavaScript
25 lines
457 B
JavaScript
'use strict';
|
|
|
|
const assert = require('assert');
|
|
const common = require('../common.js');
|
|
|
|
const { createHistogram } = require('perf_hooks');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
n: [1e5],
|
|
});
|
|
|
|
let _histogram;
|
|
|
|
function main({ n }) {
|
|
const histogram = createHistogram();
|
|
|
|
bench.start();
|
|
for (let i = 0; i < n; i++)
|
|
_histogram = structuredClone(histogram);
|
|
bench.end(n);
|
|
|
|
// Avoid V8 deadcode (elimination)
|
|
assert.ok(_histogram);
|
|
}
|