Permalink
Browse files

benchmark: remove forced optimization from buffer

This removes all instances of %OptimizeFunctionOnNextCall from buffer
benchmarks

PR-URL: #9615
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information...
bzoz committed Feb 28, 2017
1 parent 672d752 commit 05ac6e1b013be47168e17eee0c9ac9bcc21f560f
@@ -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],
@@ -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);
@@ -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);
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common.js');
const v8 = require('v8');
const bench = common.createBenchmark(main, {
method: ['offset', 'slice'],
@@ -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++)
@@ -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++)
@@ -1,7 +1,6 @@
'use strict';
const common = require('../common.js');
const v8 = require('v8');
const bench = common.createBenchmark(main, {
aligned: ['true', 'false'],
@@ -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);

0 comments on commit 05ac6e1

Please sign in to comment.