Skip to content

Commit

Permalink
benchmark: remove forced optimization from buffer
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
bzoz committed Mar 6, 2017
1 parent 672d752 commit 05ac6e1
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 31 deletions.
4 changes: 0 additions & 4 deletions benchmark/buffers/buffer-compare-instance-method.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common.js');
const v8 = require('v8');

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

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

// Force optimization before starting the benchmark
switch (args) {
case 2:
b0.compare(b1, 0);
Expand All @@ -37,8 +35,6 @@ function main(conf) {
default:
b0.compare(b1);
}
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(b0.compare)');
switch (args) {
case 2:
b0.compare(b1, 0);
Expand Down
23 changes: 0 additions & 23 deletions benchmark/buffers/buffer-compare-offset.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common.js');
const v8 = require('v8');

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

function compareUsingSlice(b0, b1, len, iter) {

// Force optimization before starting the benchmark
Buffer.compare(b0.slice(1, len), b1.slice(1, len));
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(Buffer.compare)');
eval('%OptimizeFunctionOnNextCall(b0.slice)');
eval('%OptimizeFunctionOnNextCall(b1.slice)');
Buffer.compare(b0.slice(1, len), b1.slice(1, len));
doCompareUsingSlice(b0, b1, len, iter);
}

function doCompareUsingSlice(b0, b1, len, iter) {
var i;
bench.start();
for (i = 0; i < iter; i++)
Expand All @@ -29,16 +16,6 @@ function doCompareUsingSlice(b0, b1, len, iter) {
}

function compareUsingOffset(b0, b1, len, iter) {
len = len + 1;
// Force optimization before starting the benchmark
b0.compare(b1, 1, len, 1, len);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(b0.compare)');
b0.compare(b1, 1, len, 1, len);
doCompareUsingOffset(b0, b1, len, iter);
}

function doCompareUsingOffset(b0, b1, len, iter) {
var i;
bench.start();
for (i = 0; i < iter; i++)
Expand Down
5 changes: 1 addition & 4 deletions benchmark/buffers/buffer-swap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const common = require('../common.js');
const v8 = require('v8');

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

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

bufferSwap(n, buf);
bench.start();
bufferSwap(n, buf);
bench.end(n);
Expand Down

0 comments on commit 05ac6e1

Please sign in to comment.