0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 07:53:06 +01:00
nodejs/benchmark/url/url-parse.js
Antoine du Hamel 3aef395ed5
benchmark: add trailing commas in benchmark/url
PR-URL: https://github.com/nodejs/node/pull/46551
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2023-02-10 00:54:40 +00:00

23 lines
417 B
JavaScript

'use strict';
const common = require('../common.js');
const url = require('url');
const inputs = {
normal: 'http://foo.com/bar',
escaped: 'https://foo.bar/{}^`/abcd',
};
const bench = common.createBenchmark(main, {
type: Object.keys(inputs),
n: [1e7],
});
function main({ type, n }) {
const input = inputs[type];
bench.start();
for (let i = 0; i < n; i += 1)
url.parse(input);
bench.end(n);
}