Skip to content

Commit 7587a11

Browse files
committed
benchmark: remove forced optimization from misc
This removes all instances of %OptimizeFunctionOnNextCall from misc benchmarks PR-URL: #9615 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent ef8cc30 commit 7587a11

File tree

3 files changed

+2
-23
lines changed

3 files changed

+2
-23
lines changed

benchmark/misc/console.js

-13
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ const common = require('../common.js');
44
const assert = require('assert');
55
const Writable = require('stream').Writable;
66
const util = require('util');
7-
const v8 = require('v8');
8-
9-
v8.setFlagsFromString('--allow_natives_syntax');
107

118
const methods = [
129
'restAndSpread',
@@ -51,14 +48,7 @@ function usingArgumentsAndApplyC() {
5148
nullStream.write(util.format.apply(null, arguments) + '\n');
5249
}
5350

54-
function optimize(method, ...args) {
55-
method(...args);
56-
eval(`%OptimizeFunctionOnNextCall(${method.name})`);
57-
method(...args);
58-
}
59-
6051
function runUsingRestAndConcat(n) {
61-
optimize(usingRestAndConcat, 'a', 1);
6252

6353
var i = 0;
6454
bench.start();
@@ -70,7 +60,6 @@ function runUsingRestAndConcat(n) {
7060
function runUsingRestAndSpread(n, concat) {
7161

7262
const method = concat ? usingRestAndSpreadC : usingRestAndSpreadTS;
73-
optimize(method, 'this is %s of %d', 'a', 1);
7463

7564
var i = 0;
7665
bench.start();
@@ -82,7 +71,6 @@ function runUsingRestAndSpread(n, concat) {
8271
function runUsingRestAndApply(n, concat) {
8372

8473
const method = concat ? usingRestAndApplyC : usingRestAndApplyTS;
85-
optimize(method, 'this is %s of %d', 'a', 1);
8674

8775
var i = 0;
8876
bench.start();
@@ -94,7 +82,6 @@ function runUsingRestAndApply(n, concat) {
9482
function runUsingArgumentsAndApply(n, concat) {
9583

9684
const method = concat ? usingArgumentsAndApplyC : usingArgumentsAndApplyTS;
97-
optimize(method, 'this is %s of %d', 'a', 1);
9885

9986
var i = 0;
10087
bench.start();

benchmark/misc/punycode.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ function usingICU(val) {
4242
}
4343

4444
function runPunycode(n, val) {
45-
common.v8ForceOptimization(usingPunycode, val);
4645
var i = 0;
46+
for (; i < n; i++)
47+
usingPunycode(val);
4748
bench.start();
4849
for (; i < n; i++)
4950
usingPunycode(val);
5051
bench.end(n);
5152
}
5253

5354
function runICU(n, val) {
54-
common.v8ForceOptimization(usingICU, val);
5555
var i = 0;
5656
bench.start();
5757
for (; i < n; i++)

benchmark/misc/util-extend-vs-object-assign.js

-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
const common = require('../common.js');
44
const util = require('util');
5-
const v8 = require('v8');
65

76
const bench = common.createBenchmark(main, {
87
type: ['extend', 'assign'],
@@ -12,25 +11,18 @@ const bench = common.createBenchmark(main, {
1211
function main(conf) {
1312
let fn;
1413
const n = conf.n | 0;
15-
let v8command;
1614

1715
if (conf.type === 'extend') {
1816
fn = util._extend;
19-
v8command = '%OptimizeFunctionOnNextCall(util._extend)';
2017
} else if (conf.type === 'assign') {
2118
fn = Object.assign;
22-
// Object.assign is built-in, cannot be optimized
23-
v8command = '';
2419
}
2520

2621
// Force-optimize the method to test so that the benchmark doesn't
2722
// get disrupted by the optimizer kicking in halfway through.
2823
for (var i = 0; i < conf.type.length * 10; i += 1)
2924
fn({}, process.env);
3025

31-
v8.setFlagsFromString('--allow_natives_syntax');
32-
eval(v8command);
33-
3426
var obj = new Proxy({}, { set: function(a, b, c) { return true; } });
3527

3628
bench.start();

0 commit comments

Comments
 (0)