GeezerVison is showing github.com — benchmark: remove querystring forced optimization · windwiny/node@57b5ce1
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: benchmark/querystring/querystring-parse.js +2-13Lines changed: 2 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | 'use strict'; |
2 | 2 | var common = require('../common.js'); |
3 | 3 | var querystring = require('querystring'); |
4 | | -var v8 = require('v8'); |
5 | 4 | var inputs = require('../fixtures/url-inputs.js').searchParams; |
6 | 5 |
|
7 | 6 | var bench = common.createBenchmark(main, { |
8 | 7 | type: Object.keys(inputs), |
9 | 8 | n: [1e6], |
10 | 9 | }); |
11 | 10 |
|
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 | | - |
19 | 11 | function main(conf) { |
20 | 12 | var type = conf.type; |
21 | 13 | var n = conf.n | 0; |
22 | 14 | var input = inputs[type]; |
23 | 15 | 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. |
29 | 18 | if (type === 'multicharsep') { |
30 | 19 | for (i = 0; i < n; i += 1) |
31 | 20 | querystring.parse(input, '&&&&&&&&&&'); |
|
Collapse file
Copy file name to clipboardExpand all lines: benchmark/querystring/querystring-stringify.js -5Lines changed: 0 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | 'use strict'; |
2 | 2 | var common = require('../common.js'); |
3 | 3 | var querystring = require('querystring'); |
4 | | -var v8 = require('v8'); |
5 | 4 |
|
6 | 5 | var bench = common.createBenchmark(main, { |
7 | 6 | type: ['noencode', 'encodemany', 'encodelast'], |
@@ -36,10 +35,6 @@ function main(conf) { |
36 | 35 | for (var name in inputs) |
37 | 36 | querystring.stringify(inputs[name]); |
38 | 37 |
|
39 | | - v8.setFlagsFromString('--allow_natives_syntax'); |
40 | | - eval('%OptimizeFunctionOnNextCall(querystring.stringify)'); |
41 | | - querystring.stringify(input); |
42 | | - |
43 | 38 | bench.start(); |
44 | 39 | for (var i = 0; i < n; i += 1) |
45 | 40 | querystring.stringify(input); |
|