mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
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>
This commit is contained in:
1 parent
a10c3558c6
commit
a383aee386
15 files changed
+28
-29
No files matched your search
@@ -12,7 +12,6 @@ overrides:
|
||||
- crypto/*.js
|
||||
- http/*.js
|
||||
- path/*.js
|
||||
- url/*.js
|
||||
rules:
|
||||
comma-dangle: [error, {
|
||||
arrays: always-multiline,
|
||||
|
||||
@@ -7,7 +7,7 @@ const assert = require('assert');
|
||||
const bench = common.createBenchmark(main, {
|
||||
type: common.urlDataTypes,
|
||||
method: ['legacy', 'whatwg'],
|
||||
e: [1]
|
||||
e: [1],
|
||||
});
|
||||
|
||||
function useLegacy(data) {
|
||||
@@ -20,7 +20,7 @@ function useLegacy(data) {
|
||||
port: obj.port,
|
||||
pathname: obj.pathname,
|
||||
search: obj.search,
|
||||
hash: obj.hash
|
||||
hash: obj.hash,
|
||||
};
|
||||
const len = data.length;
|
||||
// It's necessary to assign the values to an object
|
||||
@@ -51,7 +51,7 @@ function useWHATWG(data) {
|
||||
port: obj.port,
|
||||
pathname: obj.pathname,
|
||||
search: obj.search,
|
||||
hash: obj.hash
|
||||
hash: obj.hash,
|
||||
};
|
||||
const len = data.length;
|
||||
bench.start();
|
||||
|
||||
@@ -8,7 +8,7 @@ const bench = common.createBenchmark(main, {
|
||||
withBase: ['true', 'false'],
|
||||
type: common.urlDataTypes,
|
||||
e: [1],
|
||||
method: ['legacy', 'whatwg']
|
||||
method: ['legacy', 'whatwg'],
|
||||
});
|
||||
|
||||
function useLegacy(data) {
|
||||
|
||||
@@ -6,7 +6,7 @@ const searchParams = common.searchParams;
|
||||
const bench = common.createBenchmark(main, {
|
||||
searchParam: Object.keys(searchParams),
|
||||
method: ['legacy', 'whatwg'],
|
||||
n: [1e6]
|
||||
n: [1e6],
|
||||
});
|
||||
|
||||
function useLegacy(n, input) {
|
||||
|
||||
@@ -6,7 +6,7 @@ const searchParams = common.searchParams;
|
||||
const bench = common.createBenchmark(main, {
|
||||
searchParam: Object.keys(searchParams),
|
||||
method: ['legacy', 'whatwg'],
|
||||
n: [1e6]
|
||||
n: [1e6],
|
||||
});
|
||||
|
||||
function useLegacy(n, input, prop) {
|
||||
|
||||
@@ -7,7 +7,7 @@ const assert = require('assert');
|
||||
const bench = common.createBenchmark(main, {
|
||||
type: common.urlDataTypes,
|
||||
method: ['legacy', 'whatwg'],
|
||||
e: [1]
|
||||
e: [1],
|
||||
});
|
||||
|
||||
function useLegacy(data) {
|
||||
|
||||
@@ -9,7 +9,7 @@ const inputs = {
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
type: Object.keys(inputs),
|
||||
n: [25e6]
|
||||
n: [25e6],
|
||||
});
|
||||
|
||||
function main({ type, n }) {
|
||||
|
||||
@@ -4,12 +4,12 @@ const url = require('url');
|
||||
|
||||
const inputs = {
|
||||
normal: 'http://foo.com/bar',
|
||||
escaped: 'https://foo.bar/{}^`/abcd'
|
||||
escaped: 'https://foo.bar/{}^`/abcd',
|
||||
};
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
type: Object.keys(inputs),
|
||||
n: [1e7]
|
||||
n: [1e7],
|
||||
});
|
||||
|
||||
function main({ type, n }) {
|
||||
|
||||
@@ -9,13 +9,13 @@ const paths = {
|
||||
'sibling': '../foo/bar?baz=boom',
|
||||
'foo/bar': 'foo/bar',
|
||||
'withscheme': 'http://nodejs.org',
|
||||
'down': './foo/bar?baz'
|
||||
'down': './foo/bar?baz',
|
||||
};
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
href: Object.keys(hrefs),
|
||||
path: Object.keys(paths),
|
||||
n: [1e5]
|
||||
n: [1e5],
|
||||
});
|
||||
|
||||
function main({ n, href, path }) {
|
||||
|
||||
@@ -4,7 +4,7 @@ const assert = require('assert');
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
loopMethod: ['forEach', 'iterator'],
|
||||
n: [1e6]
|
||||
n: [1e6],
|
||||
});
|
||||
|
||||
const str = 'one=single&two=first&three=first&two=2nd&three=2nd&three=3rd';
|
||||
|
||||
@@ -4,7 +4,7 @@ const common = require('../common.js');
|
||||
const bench = common.createBenchmark(main, {
|
||||
accessMethod: ['get', 'getAll', 'has'],
|
||||
param: ['one', 'two', 'three', 'nonexistent'],
|
||||
n: [2e7]
|
||||
n: [2e7],
|
||||
});
|
||||
|
||||
const str = 'one=single&two=first&three=first&two=2nd&three=2nd&three=3rd';
|
||||
|
||||
@@ -13,7 +13,7 @@ const inputs = {
|
||||
// 88 parameters
|
||||
long: 'g&r&t&h&s&r&d&w&b&n&h&k&x&m&k&h&o&e&x&c&c&g&e&b&p&p&s&n&j&b&y&z&' +
|
||||
'u&l&o&r&w&a&u&l&m&f&j&q&p&f&e&y&e&n&e&l&m&w&u&w&t&n&t&q&v&y&c&o&' +
|
||||
'k&f&j&i&l&m&g&j&d&i&z&q&p&x&q&q&d&n&y&w&g&i&v&r'
|
||||
'k&f&j&i&l&m&g&j&d&i&z&q&p&x&q&q&d&n&y&w&g&i&v&r',
|
||||
};
|
||||
|
||||
function getParams(str) {
|
||||
@@ -26,9 +26,9 @@ function getParams(str) {
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
type: Object.keys(inputs),
|
||||
n: [1e6]
|
||||
n: [1e6],
|
||||
}, {
|
||||
flags: ['--expose-internals']
|
||||
flags: ['--expose-internals'],
|
||||
});
|
||||
|
||||
function main({ type, n }) {
|
||||
|
||||
@@ -7,13 +7,13 @@ const inputs = {
|
||||
'\ud800\udfff',
|
||||
someinvalid: 'asasfdfasd\uda23',
|
||||
allinvalid: '\udc45\uda23 \udf00\udc00 \udfaa\uda12 \udc00\udfaa',
|
||||
nonstring: { toString() { return 'asdf'; } }
|
||||
nonstring: { toString() { return 'asdf'; } },
|
||||
};
|
||||
const bench = common.createBenchmark(main, {
|
||||
input: Object.keys(inputs),
|
||||
n: [5e7]
|
||||
n: [5e7],
|
||||
}, {
|
||||
flags: ['--expose-internals']
|
||||
flags: ['--expose-internals'],
|
||||
});
|
||||
|
||||
function main({ input, n }) {
|
||||
|
||||
@@ -5,30 +5,30 @@ const { domainToASCII, domainToUnicode } = require('url');
|
||||
const domains = {
|
||||
empty: {
|
||||
ascii: '',
|
||||
unicode: ''
|
||||
unicode: '',
|
||||
},
|
||||
none: {
|
||||
ascii: 'passports',
|
||||
unicode: 'passports'
|
||||
unicode: 'passports',
|
||||
},
|
||||
some: {
|
||||
ascii: 'Paßstraße',
|
||||
unicode: 'xn--Pastrae-1vae'
|
||||
unicode: 'xn--Pastrae-1vae',
|
||||
},
|
||||
all: {
|
||||
ascii: '他们不说中文',
|
||||
unicode: 'xn--ihqwczyycu19kkg2c'
|
||||
unicode: 'xn--ihqwczyycu19kkg2c',
|
||||
},
|
||||
nonstring: {
|
||||
ascii: { toString() { return ''; } },
|
||||
unicode: { toString() { return ''; } }
|
||||
}
|
||||
unicode: { toString() { return ''; } },
|
||||
},
|
||||
};
|
||||
|
||||
const bench = common.createBenchmark(main, {
|
||||
domain: Object.keys(domains),
|
||||
to: ['ascii', 'unicode'],
|
||||
n: [5e6]
|
||||
n: [5e6],
|
||||
});
|
||||
|
||||
function main({ n, to, domain }) {
|
||||
|
||||
@@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, {
|
||||
e: [1],
|
||||
prop: ['href', 'origin', 'protocol',
|
||||
'username', 'password', 'host', 'hostname', 'port',
|
||||
'pathname', 'search', 'searchParams', 'hash']
|
||||
'pathname', 'search', 'searchParams', 'hash'],
|
||||
});
|
||||
|
||||
function setAndGet(data, prop) {
|
||||
|
||||
Reference in new issue
Block a user