0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
nodejs/test/benchmark/test-benchmark-url.js
Joyee Cheung a365bb9cb1
benchmark: pre-generate data set for URL benchmarks
This patch:

- Introduces `common.bakeUrlData` which can be used to pre-generate
  the data set for the URL benchmarks to loop through instead of
  looping over a constant.
- Add the option to use WPT data in benchmarks for better diversity
  in the input
- Add the option to benchmark URL parsing with base URLs (whatwg only)
- Moves the data in `benchmark/fixtures/url-inputs.js` to
  `benchmark/common.js`

PR-URL: https://github.com/nodejs/node/pull/24302
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-11-20 05:14:34 +08:00

26 lines
642 B
JavaScript

'use strict';
require('../common');
const runBenchmark = require('../common/benchmark');
runBenchmark('url',
[
'method=legacy',
'e=0',
'loopMethod=forEach',
'accessMethod=get',
'type=short',
'searchParam=noencode',
'href=short',
'input=short',
'domain=empty',
'path=up',
'to=ascii',
'prop=href',
'n=1',
'param=one',
'withBase=false'
],
{ NODEJS_BENCHMARK_ZERO_ALLOWED: 1 });