Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,33 @@
'use strict';
const common = require('../common.js');
const querystring = require('querystring');
const inputs = common.searchParams;
const bench = common.createBenchmark(main, {
type: Object.keys(inputs),
n: [1e6],
});
function main({ type, n }) {
const input = inputs[type];
// Execute the function a "sufficient" number of times before the timed
// loop to ensure the function is optimized just once.
if (type === 'multicharsep') {
for (let i = 0; i < n; i += 1)
querystring.parse(input, '&&&&&&&&&&');
bench.start();
for (let i = 0; i < n; i += 1)
querystring.parse(input, '&&&&&&&&&&');
bench.end(n);
} else {
for (let i = 0; i < n; i += 1)
querystring.parse(input);
bench.start();
for (let i = 0; i < n; i += 1)
querystring.parse(input);
bench.end(n);
}
}

View File

@ -0,0 +1,49 @@
'use strict';
const common = require('../common.js');
const querystring = require('querystring');
const bench = common.createBenchmark(main, {
type: ['noencode', 'encodemany', 'encodelast', 'array', 'multiprimitives'],
n: [1e6],
});
function main({ type, n }) {
const inputs = {
noencode: {
foo: 'bar',
baz: 'quux',
xyzzy: 'thud',
},
encodemany: {
'\u0080\u0083\u0089': 'bar',
'\u008C\u008E\u0099': 'quux',
'xyzzy': '\u00A5q\u00A3r',
},
encodelast: {
foo: 'bar',
baz: 'quux',
xyzzy: 'thu\u00AC',
},
array: {
foo: [],
baz: ['bar'],
xyzzy: ['bar', 'quux', 'thud'],
},
multiprimitives: {
foo: false,
bar: -13.37,
baz: '',
},
};
const input = inputs[type];
// Force-optimize querystring.stringify() so that the benchmark doesn't get
// disrupted by the optimizer kicking in halfway through.
for (const name in inputs)
querystring.stringify(inputs[name]);
bench.start();
for (let i = 0; i < n; i += 1)
querystring.stringify(input);
bench.end(n);
}

View File

@ -0,0 +1,20 @@
'use strict';
const common = require('../common.js');
const querystring = require('querystring');
const bench = common.createBenchmark(main, {
input: [
'there is nothing to unescape here',
'there%20are%20several%20spaces%20that%20need%20to%20be%20unescaped',
'there%2Qare%0-fake%escaped values in%%%%this%9Hstring',
'%20%21%22%23%24%25%26%27%28%29%2A%2B%2C%2D%2E%2F%30%31%32%33%34%35%36%37',
],
n: [10e6],
});
function main({ input, n }) {
bench.start();
for (let i = 0; i < n; i += 1)
querystring.unescapeBuffer(input);
bench.end(n);
}