Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions benchmark/url/url.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var common = require('../common.js');
var url = require('url');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
type: 'one two three four five six'.split(' '),
Expand All @@ -20,6 +21,14 @@ function main(conf) {
};
var input = inputs[type] || '';

// Force-optimize url.parse() so that the benchmark doesn't get
// disrupted by the optimizer kicking in halfway through.
for (var name in inputs)
url.parse(inputs[name]);

v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(url.parse)');

bench.start();
for (var i = 0; i < n; i += 1)
url.parse(input);
Expand Down