Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2017-12-30 05:54:51 +0300
committerRuben Bridgewater <ruben@bridgewater.de>2018-01-23 03:29:16 +0300
commit49f5e0818842740770fef1b25bca30c6dc826841 (patch)
treeacdf9e9a7424898926383c3b2af399cad3d72ff5 /benchmark/url
parent366fd03af00407e9b45d91d9df66b3ab34b10f35 (diff)
benchmark: (url) use destructuring
PR-URL: https://github.com/nodejs/node/pull/18250 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'benchmark/url')
-rw-r--r--benchmark/url/legacy-vs-whatwg-url-get-prop.js6
-rw-r--r--benchmark/url/legacy-vs-whatwg-url-parse.js6
-rw-r--r--benchmark/url/legacy-vs-whatwg-url-searchparams-parse.js6
-rw-r--r--benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js6
-rw-r--r--benchmark/url/legacy-vs-whatwg-url-serialize.js6
-rw-r--r--benchmark/url/url-format.js5
-rw-r--r--benchmark/url/url-resolve.js9
-rw-r--r--benchmark/url/url-searchparams-iteration.js5
-rw-r--r--benchmark/url/url-searchparams-read.js6
-rw-r--r--benchmark/url/url-searchparams-sort.js5
-rw-r--r--benchmark/url/usvstring.js5
-rw-r--r--benchmark/url/whatwg-url-idna.js8
-rw-r--r--benchmark/url/whatwg-url-properties.js8
13 files changed, 22 insertions, 59 deletions
diff --git a/benchmark/url/legacy-vs-whatwg-url-get-prop.js b/benchmark/url/legacy-vs-whatwg-url-get-prop.js
index 229a4e60652..93603c258cf 100644
--- a/benchmark/url/legacy-vs-whatwg-url-get-prop.js
+++ b/benchmark/url/legacy-vs-whatwg-url-get-prop.js
@@ -71,11 +71,7 @@ function useWHATWG(n, input) {
return noDead;
}
-function main(conf) {
- const type = conf.type;
- const n = conf.n | 0;
- const method = conf.method;
-
+function main({ type, n, method }) {
const input = inputs[type];
if (!input) {
throw new Error('Unknown input type');
diff --git a/benchmark/url/legacy-vs-whatwg-url-parse.js b/benchmark/url/legacy-vs-whatwg-url-parse.js
index ec386b7b855..da42d5a189a 100644
--- a/benchmark/url/legacy-vs-whatwg-url-parse.js
+++ b/benchmark/url/legacy-vs-whatwg-url-parse.js
@@ -31,11 +31,7 @@ function useWHATWG(n, input) {
return noDead;
}
-function main(conf) {
- const type = conf.type;
- const n = conf.n | 0;
- const method = conf.method;
-
+function main({ type, n, method }) {
const input = inputs[type];
if (!input) {
throw new Error('Unknown input type');
diff --git a/benchmark/url/legacy-vs-whatwg-url-searchparams-parse.js b/benchmark/url/legacy-vs-whatwg-url-searchparams-parse.js
index b4a80af4e5e..51953ec8707 100644
--- a/benchmark/url/legacy-vs-whatwg-url-searchparams-parse.js
+++ b/benchmark/url/legacy-vs-whatwg-url-searchparams-parse.js
@@ -28,11 +28,7 @@ function useWHATWG(n, input) {
bench.end(n);
}
-function main(conf) {
- const type = conf.type;
- const n = conf.n | 0;
- const method = conf.method;
-
+function main({ type, n, method }) {
const input = inputs[type];
if (!input) {
throw new Error('Unknown input type');
diff --git a/benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js b/benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js
index 2b8d2c36a81..3490782a1bf 100644
--- a/benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js
+++ b/benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js
@@ -30,11 +30,7 @@ function useWHATWG(n, input, prop) {
bench.end(n);
}
-function main(conf) {
- const type = conf.type;
- const n = conf.n | 0;
- const method = conf.method;
-
+function main({ type, n, method }) {
const input = inputs[type];
if (!input) {
throw new Error('Unknown input type');
diff --git a/benchmark/url/legacy-vs-whatwg-url-serialize.js b/benchmark/url/legacy-vs-whatwg-url-serialize.js
index 35b459a10c0..e92b941b5d5 100644
--- a/benchmark/url/legacy-vs-whatwg-url-serialize.js
+++ b/benchmark/url/legacy-vs-whatwg-url-serialize.js
@@ -33,11 +33,7 @@ function useWHATWG(n, input, prop) {
return noDead;
}
-function main(conf) {
- const type = conf.type;
- const n = conf.n | 0;
- const method = conf.method;
-
+function main({ type, n, method }) {
const input = inputs[type];
if (!input) {
throw new Error('Unknown input type');
diff --git a/benchmark/url/url-format.js b/benchmark/url/url-format.js
index dc8e020879e..14696af8e31 100644
--- a/benchmark/url/url-format.js
+++ b/benchmark/url/url-format.js
@@ -12,10 +12,7 @@ const bench = common.createBenchmark(main, {
n: [25e6]
});
-function main(conf) {
- const type = conf.type;
- const n = conf.n | 0;
-
+function main({ type, n }) {
const input = inputs[type] || '';
// Force-optimize url.format() so that the benchmark doesn't get
diff --git a/benchmark/url/url-resolve.js b/benchmark/url/url-resolve.js
index 421a70ef6d5..48978574ea2 100644
--- a/benchmark/url/url-resolve.js
+++ b/benchmark/url/url-resolve.js
@@ -18,13 +18,12 @@ const bench = common.createBenchmark(main, {
n: [1e5]
});
-function main(conf) {
- const n = conf.n | 0;
- const href = hrefs[conf.href];
- const path = paths[conf.path];
+function main({ n, href, path }) {
+ const h = hrefs[href];
+ const p = paths[path];
bench.start();
for (var i = 0; i < n; i += 1)
- url.resolve(href, path);
+ url.resolve(h, p);
bench.end(n);
}
diff --git a/benchmark/url/url-searchparams-iteration.js b/benchmark/url/url-searchparams-iteration.js
index 0f4b71a0a18..2b13992bdfc 100644
--- a/benchmark/url/url-searchparams-iteration.js
+++ b/benchmark/url/url-searchparams-iteration.js
@@ -44,10 +44,7 @@ function iterator(n) {
assert.strictEqual(noDead[1], '3rd');
}
-function main(conf) {
- const method = conf.method;
- const n = conf.n | 0;
-
+function main({ method, n }) {
switch (method) {
case 'forEach':
forEach(n);
diff --git a/benchmark/url/url-searchparams-read.js b/benchmark/url/url-searchparams-read.js
index 762ffcca03d..29235ee81e0 100644
--- a/benchmark/url/url-searchparams-read.js
+++ b/benchmark/url/url-searchparams-read.js
@@ -37,11 +37,7 @@ function has(n, param) {
bench.end(n);
}
-function main(conf) {
- const method = conf.method;
- const param = conf.param;
- const n = conf.n | 0;
-
+function main({ method, param, n }) {
switch (method) {
case 'get':
get(n, param);
diff --git a/benchmark/url/url-searchparams-sort.js b/benchmark/url/url-searchparams-sort.js
index 677ce511cf3..524dacb6d52 100644
--- a/benchmark/url/url-searchparams-sort.js
+++ b/benchmark/url/url-searchparams-sort.js
@@ -31,10 +31,9 @@ const bench = common.createBenchmark(main, {
flags: ['--expose-internals']
});
-function main(conf) {
+function main({ type, n }) {
const searchParams = require('internal/url').searchParamsSymbol;
- const input = inputs[conf.type];
- const n = conf.n | 0;
+ const input = inputs[type];
const params = new URLSearchParams();
const array = getParams(input);
diff --git a/benchmark/url/usvstring.js b/benchmark/url/usvstring.js
index 40a94503738..91abe8d6735 100644
--- a/benchmark/url/usvstring.js
+++ b/benchmark/url/usvstring.js
@@ -16,10 +16,9 @@ const bench = common.createBenchmark(main, {
flags: ['--expose-internals']
});
-function main(conf) {
+function main({ input, n }) {
const { toUSVString } = require('internal/url');
- const str = inputs[conf.input];
- const n = conf.n | 0;
+ const str = inputs[input];
bench.start();
for (var i = 0; i < n; i++)
diff --git a/benchmark/url/whatwg-url-idna.js b/benchmark/url/whatwg-url-idna.js
index 3d0ea3dc8fe..c1e3d4a0b85 100644
--- a/benchmark/url/whatwg-url-idna.js
+++ b/benchmark/url/whatwg-url-idna.js
@@ -31,15 +31,13 @@ const bench = common.createBenchmark(main, {
n: [5e6]
});
-function main(conf) {
- const n = conf.n | 0;
- const to = conf.to;
- const input = inputs[conf.input][to];
+function main({ n, to, input }) {
+ const value = inputs[input][to];
const method = to === 'ascii' ? domainToASCII : domainToUnicode;
bench.start();
for (var i = 0; i < n; i++) {
- method(input);
+ method(value);
}
bench.end(n);
}
diff --git a/benchmark/url/whatwg-url-properties.js b/benchmark/url/whatwg-url-properties.js
index 3a865d2335a..f526c07f139 100644
--- a/benchmark/url/whatwg-url-properties.js
+++ b/benchmark/url/whatwg-url-properties.js
@@ -46,11 +46,9 @@ function getAlternative(prop) {
return alternatives[prop];
}
-function main(conf) {
- const n = conf.n | 0;
- const input = inputs[conf.input];
- const url = new URL(input);
- const prop = conf.prop;
+function main({ n, input, prop }) {
+ const value = inputs[input];
+ const url = new URL(value);
switch (prop) {
case 'protocol':