Skip to content

Commit

Permalink
url: add benchmark to check impact of searchParams checking
Browse files Browse the repository at this point in the history
  • Loading branch information
MattIPv4 committed Jan 19, 2024
1 parent 5d9bd42 commit 8c0a218
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions benchmark/url/url-searchparams-update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';
const common = require('../common.js');

const bench = common.createBenchmark(main, {
searchParams: ['true', 'false'],
n: [1e6],
});

function main({ searchParams, n }) {
const url = new URL('https://nodejs.org');
if (searchParams === 'true') url.searchParams;

Check failure on line 11 in benchmark/url/url-searchparams-update.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Expected an assignment or function call and instead saw an expression

bench.start();
for (let i = 0; i < n; i++) {
url.pathname = `/${n}`;
}
bench.end(n);
}

0 comments on commit 8c0a218

Please sign in to comment.