Skip to content

Commit

Permalink
benchmark: add trailing commas in benchmark/url
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
aduh95 authored and danielleadams committed Apr 3, 2023
1 parent a10c355 commit a383aee
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 29 deletions.
1 change: 0 additions & 1 deletion benchmark/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ overrides:
- crypto/*.js
- http/*.js
- path/*.js
- url/*.js
rules:
comma-dangle: [error, {
arrays: always-multiline,
Expand Down
6 changes: 3 additions & 3 deletions benchmark/url/legacy-vs-whatwg-url-get-prop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion benchmark/url/legacy-vs-whatwg-url-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/url/legacy-vs-whatwg-url-searchparams-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/url/legacy-vs-whatwg-url-serialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/url/url-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const inputs = {

const bench = common.createBenchmark(main, {
type: Object.keys(inputs),
n: [25e6]
n: [25e6],
});

function main({ type, n }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/url/url-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/url/url-resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/url/url-searchparams-iteration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion benchmark/url/url-searchparams-read.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
6 changes: 3 additions & 3 deletions benchmark/url/url-searchparams-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 }) {
Expand Down
6 changes: 3 additions & 3 deletions benchmark/url/usvstring.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down
14 changes: 7 additions & 7 deletions benchmark/url/whatwg-url-idna.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/url/whatwg-url-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a383aee

Please sign in to comment.