Skip to content

Commit 57b5ce1

Browse files
committed
benchmark: remove querystring forced optimization
This removes all instances of %OptimizeFunctionOnNextCall from querystring benchmarks PR-URL: #9615 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent eba2c62 commit 57b5ce1

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

benchmark/querystring/querystring-parse.js

+2-13
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,20 @@
11
'use strict';
22
var common = require('../common.js');
33
var querystring = require('querystring');
4-
var v8 = require('v8');
54
var inputs = require('../fixtures/url-inputs.js').searchParams;
65

76
var bench = common.createBenchmark(main, {
87
type: Object.keys(inputs),
98
n: [1e6],
109
});
1110

12-
// A deopt followed by a reopt of main() can happen right when the timed loop
13-
// starts, which seems to have a noticeable effect on the benchmark results.
14-
// So we explicitly disable optimization of main() to avoid this potential
15-
// issue.
16-
v8.setFlagsFromString('--allow_natives_syntax');
17-
eval('%NeverOptimizeFunction(main)');
18-
1911
function main(conf) {
2012
var type = conf.type;
2113
var n = conf.n | 0;
2214
var input = inputs[type];
2315
var i;
24-
25-
// Note: we do *not* use OptimizeFunctionOnNextCall() here because currently
26-
// it causes a deopt followed by a reopt, which could make its way into the
27-
// timed loop. Instead, just execute the function a "sufficient" number of
28-
// times before the timed loop to ensure the function is optimized just once.
16+
// Execute the function a "sufficient" number of times before the timed
17+
// loop to ensure the function is optimized just once.
2918
if (type === 'multicharsep') {
3019
for (i = 0; i < n; i += 1)
3120
querystring.parse(input, '&&&&&&&&&&');

benchmark/querystring/querystring-stringify.js

-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22
var common = require('../common.js');
33
var querystring = require('querystring');
4-
var v8 = require('v8');
54

65
var bench = common.createBenchmark(main, {
76
type: ['noencode', 'encodemany', 'encodelast'],
@@ -36,10 +35,6 @@ function main(conf) {
3635
for (var name in inputs)
3736
querystring.stringify(inputs[name]);
3837

39-
v8.setFlagsFromString('--allow_natives_syntax');
40-
eval('%OptimizeFunctionOnNextCall(querystring.stringify)');
41-
querystring.stringify(input);
42-
4338
bench.start();
4439
for (var i = 0; i < n; i += 1)
4540
querystring.stringify(input);

0 commit comments

Comments
 (0)