mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
925a464cb8
PR-URL: https://github.com/nodejs/node/pull/51520 Fixes: https://github.com/nodejs/node/issues/51518 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
20 lines
399 B
JavaScript
20 lines
399 B
JavaScript
'use strict';
|
|
const common = require('../common.js');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
type: ['URL', 'URLSearchParams'],
|
|
n: [1e3, 1e6],
|
|
});
|
|
|
|
function main({ type, n }) {
|
|
const params = type === 'URL' ?
|
|
new URL('https://nodejs.org').searchParams :
|
|
new URLSearchParams();
|
|
|
|
bench.start();
|
|
for (let i = 0; i < n; i++) {
|
|
params.append('test', i);
|
|
}
|
|
bench.end(n);
|
|
}
|