Skip to content

Commit 05ac6e1

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

File tree

3 files changed

+1
-31
lines changed

3 files changed

+1
-31
lines changed

benchmark/buffers/buffer-compare-instance-method.js

-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22
const common = require('../common.js');
3-
const v8 = require('v8');
43

54
const bench = common.createBenchmark(main, {
65
size: [16, 512, 1024, 4096, 16386],
@@ -20,7 +19,6 @@ function main(conf) {
2019

2120
b1[size - 1] = 'b'.charCodeAt(0);
2221

23-
// Force optimization before starting the benchmark
2422
switch (args) {
2523
case 2:
2624
b0.compare(b1, 0);
@@ -37,8 +35,6 @@ function main(conf) {
3735
default:
3836
b0.compare(b1);
3937
}
40-
v8.setFlagsFromString('--allow_natives_syntax');
41-
eval('%OptimizeFunctionOnNextCall(b0.compare)');
4238
switch (args) {
4339
case 2:
4440
b0.compare(b1, 0);

benchmark/buffers/buffer-compare-offset.js

-23
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22
const common = require('../common.js');
3-
const v8 = require('v8');
43

54
const bench = common.createBenchmark(main, {
65
method: ['offset', 'slice'],
@@ -9,18 +8,6 @@ const bench = common.createBenchmark(main, {
98
});
109

1110
function compareUsingSlice(b0, b1, len, iter) {
12-
13-
// Force optimization before starting the benchmark
14-
Buffer.compare(b0.slice(1, len), b1.slice(1, len));
15-
v8.setFlagsFromString('--allow_natives_syntax');
16-
eval('%OptimizeFunctionOnNextCall(Buffer.compare)');
17-
eval('%OptimizeFunctionOnNextCall(b0.slice)');
18-
eval('%OptimizeFunctionOnNextCall(b1.slice)');
19-
Buffer.compare(b0.slice(1, len), b1.slice(1, len));
20-
doCompareUsingSlice(b0, b1, len, iter);
21-
}
22-
23-
function doCompareUsingSlice(b0, b1, len, iter) {
2411
var i;
2512
bench.start();
2613
for (i = 0; i < iter; i++)
@@ -29,16 +16,6 @@ function doCompareUsingSlice(b0, b1, len, iter) {
2916
}
3017

3118
function compareUsingOffset(b0, b1, len, iter) {
32-
len = len + 1;
33-
// Force optimization before starting the benchmark
34-
b0.compare(b1, 1, len, 1, len);
35-
v8.setFlagsFromString('--allow_natives_syntax');
36-
eval('%OptimizeFunctionOnNextCall(b0.compare)');
37-
b0.compare(b1, 1, len, 1, len);
38-
doCompareUsingOffset(b0, b1, len, iter);
39-
}
40-
41-
function doCompareUsingOffset(b0, b1, len, iter) {
4219
var i;
4320
bench.start();
4421
for (i = 0; i < iter; i++)

benchmark/buffers/buffer-swap.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
const common = require('../common.js');
4-
const v8 = require('v8');
54

65
const bench = common.createBenchmark(main, {
76
aligned: ['true', 'false'],
@@ -81,9 +80,7 @@ function main(conf) {
8180
const buf = createBuffer(len, aligned === 'true');
8281
const bufferSwap = genMethod(method);
8382

84-
v8.setFlagsFromString('--allow_natives_syntax');
85-
eval('%OptimizeFunctionOnNextCall(bufferSwap)');
86-
83+
bufferSwap(n, buf);
8784
bench.start();
8885
bufferSwap(n, buf);
8986
bench.end(n);

0 commit comments

Comments
 (0)