Skip to content

Commit

Permalink
benchmark: move url data to fixtures
Browse files Browse the repository at this point in the history
PR-URL: nodejs#11264
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Brian White <[email protected]>
  • Loading branch information
joyeecheung authored and italoacasas committed Feb 16, 2017
1 parent f27d5c5 commit b9bc94f
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 63 deletions.
30 changes: 30 additions & 0 deletions benchmark/fixtures/url-inputs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';

exports.urls = {
long: 'http://nodejs.org:89/docs/latest/api/foo/bar/qua/13949281/0f28b/' +
'/5d49/b3020/url.html#test?payload1=true&payload2=false&test=1' +
'&benchmark=3&foo=38.38.011.293&bar=1234834910480&test=19299&3992&' +
'key=f5c65e1e98fe07e648249ad41e1cfdb0',
short: 'https://nodejs.org/en/blog/',
idn: 'http://你好你好.在线',
auth: 'https://user:[email protected]/path?search=1',
file: 'file:///foo/bar/test/node.js',
ws: 'ws://localhost:9229/f46db715-70df-43ad-a359-7f9949f39868',
javascript: 'javascript:alert("node is awesome");',
percent: 'https://%E4%BD%A0/foo',
dot: 'https://example.org/./a/../b/./c'
};

exports.searchParams = {
noencode: 'foo=bar&baz=quux&xyzzy=thud',
multicharsep: 'foo=bar&&&&&&&&&&baz=quux&&&&&&&&&&xyzzy=thud',
encodefake: 'foo=%©ar&baz=%A©uux&xyzzy=%©ud',
encodemany: '%66%6F%6F=bar&%62%61%7A=quux&xyzzy=%74h%75d',
encodelast: 'foo=bar&baz=quux&xyzzy=thu%64',
multivalue: 'foo=bar&foo=baz&foo=quux&quuy=quuz',
multivaluemany: 'foo=bar&foo=baz&foo=quux&quuy=quuz&foo=abc&foo=def&' +
'foo=ghi&foo=jkl&foo=mno&foo=pqr&foo=stu&foo=vwxyz',
manypairs: 'a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z',
manyblankpairs: '&&&&&&&&&&&&&&&&&&&&&&&&',
altspaces: 'foo+bar=baz+quux&xyzzy+thud=quuy+quuz&abc=def+ghi'
};
14 changes: 1 addition & 13 deletions benchmark/url/legacy-vs-whatwg-url-get-prop.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,7 @@ const common = require('../common.js');
const url = require('url');
const URL = url.URL;
const assert = require('assert');

const inputs = {
long: 'http://nodejs.org:89/docs/latest/api/url.html#test?' +
'payload1=true&payload2=false&test=1&benchmark=3&' +
'foo=38.38.011.293&bar=1234834910480&test=19299&3992&' +
'key=f5c65e1e98fe07e648249ad41e1cfdb0',
short: 'https://nodejs.org/en/blog/',
idn: 'http://你好你好',
auth: 'https://user:[email protected]/path?search=1',
special: 'file:///foo/bar/test/node.js',
percent: 'https://%E4%BD%A0/foo',
dot: 'https://example.org/./a/../b/./c'
};
const inputs = require('../fixtures/url-inputs.js').urls;

const bench = common.createBenchmark(main, {
type: Object.keys(inputs),
Expand Down
14 changes: 1 addition & 13 deletions benchmark/url/legacy-vs-whatwg-url-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,7 @@ const common = require('../common.js');
const url = require('url');
const URL = url.URL;
const assert = require('assert');

const inputs = {
long: 'http://nodejs.org:89/docs/latest/api/url.html#test?' +
'payload1=true&payload2=false&test=1&benchmark=3&' +
'foo=38.38.011.293&bar=1234834910480&test=19299&3992&' +
'key=f5c65e1e98fe07e648249ad41e1cfdb0',
short: 'https://nodejs.org/en/blog/',
idn: 'http://你好你好',
auth: 'https://user:[email protected]/path?search=1',
special: 'file:///foo/bar/test/node.js',
percent: 'https://%E4%BD%A0/foo',
dot: 'https://example.org/./a/../b/./c'
};
const inputs = require('../fixtures/url-inputs.js').urls;

const bench = common.createBenchmark(main, {
type: Object.keys(inputs),
Expand Down
13 changes: 1 addition & 12 deletions benchmark/url/legacy-vs-whatwg-url-searchparams-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@
const common = require('../common.js');
const { URLSearchParams } = require('url');
const querystring = require('querystring');

const inputs = {
noencode: 'foo=bar&baz=quux&xyzzy=thud',
encodemany: '%66%6F%6F=bar&%62%61%7A=quux&xyzzy=%74h%75d',
encodefake: 'foo=%©ar&baz=%A©uux&xyzzy=%©ud',
encodelast: 'foo=bar&baz=quux&xyzzy=thu%64',
multicharsep: 'foo=bar&&&&&&&&&&baz=quux&&&&&&&&&&xyzzy=thud',
multivalue: 'foo=bar&foo=baz&foo=quux&quuy=quuz',
multivaluemany: 'foo=bar&foo=baz&foo=quux&quuy=quuz&foo=abc&foo=def&' +
'foo=ghi&foo=jkl&foo=mno&foo=pqr&foo=stu&foo=vwxyz',
manypairs: 'a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z'
};
const inputs = require('../fixtures/url-inputs.js').searchParams;

const bench = common.createBenchmark(main, {
type: Object.keys(inputs),
Expand Down
13 changes: 1 addition & 12 deletions benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@
const common = require('../common.js');
const { URLSearchParams } = require('url');
const querystring = require('querystring');

const inputs = {
noencode: 'foo=bar&baz=quux&xyzzy=thud',
encodemany: '%66%6F%6F=bar&%62%61%7A=quux&xyzzy=%74h%75d',
encodefake: 'foo=%©ar&baz=%A©uux&xyzzy=%©ud',
encodelast: 'foo=bar&baz=quux&xyzzy=thu%64',
multicharsep: 'foo=bar&&&&&&&&&&baz=quux&&&&&&&&&&xyzzy=thud',
multivalue: 'foo=bar&foo=baz&foo=quux&quuy=quuz',
multivaluemany: 'foo=bar&foo=baz&foo=quux&quuy=quuz&foo=abc&foo=def&' +
'foo=ghi&foo=jkl&foo=mno&foo=pqr&foo=stu&foo=vwxyz',
manypairs: 'a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z'
};
const inputs = require('../fixtures/url-inputs.js').searchParams;

const bench = common.createBenchmark(main, {
type: Object.keys(inputs),
Expand Down
14 changes: 1 addition & 13 deletions benchmark/url/legacy-vs-whatwg-url-serialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,7 @@ const common = require('../common.js');
const url = require('url');
const URL = url.URL;
const assert = require('assert');

const inputs = {
long: 'http://nodejs.org:89/docs/latest/api/url.html#test?' +
'payload1=true&payload2=false&test=1&benchmark=3&' +
'foo=38.38.011.293&bar=1234834910480&test=19299&3992&' +
'key=f5c65e1e98fe07e648249ad41e1cfdb0',
short: 'https://nodejs.org/en/blog/',
idn: 'http://你好你好',
auth: 'https://user:[email protected]/path?search=1',
special: 'file:///foo/bar/test/node.js',
percent: 'https://%E4%BD%A0/foo',
dot: 'https://example.org/./a/../b/./c'
};
const inputs = require('../fixtures/url-inputs.js').urls;

const bench = common.createBenchmark(main, {
type: Object.keys(inputs),
Expand Down

0 comments on commit b9bc94f

Please sign in to comment.