GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — benchmark: fix url-searchparams-sort to sort a fresh list · nodejs/node@442228e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • benchmark/url
    • url-searchparams-sort.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎benchmark/url/url-searchparams-sort.js‎

Copy file name to clipboardExpand all lines: benchmark/url/url-searchparams-sort.js
+2-15Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,17 @@ const inputs = {
1616
'k&f&j&i&l&m&g&j&d&i&z&q&p&x&q&q&d&n&y&w&g&i&v&r',
1717
};
1818

19-
function getParams(str) {
20-
const out = [];
21-
for (const key of str.split('&')) {
22-
out.push(key, '');
23-
}
24-
return out;
25-
}
26-
2719
const bench = common.createBenchmark(main, {
2820
type: Object.keys(inputs),
2921
n: [1e6],
30-
}, {
31-
flags: ['--expose-internals'],
3222
});
3323

3424
function main({ type, n }) {
35-
const searchParams = require('internal/url').searchParamsSymbol;
36-
const input = inputs[type];
37-
const params = new URLSearchParams();
38-
const array = getParams(input);
25+
const base = new URLSearchParams(inputs[type]);
3926

4027
bench.start();
4128
for (let i = 0; i < n; i++) {
42-
params[searchParams] = array.slice();
29+
const params = new URLSearchParams(base);
4330
params.sort();
4431
}
4532
bench.end(n);

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.