Browse Source

benchmark: remove forced optimization from buffer

This removes all instances of %OptimizeFunctionOnNextCall from buffer
benchmarks

PR-URL: https://github.com/nodejs/node/pull/9615
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
v6
Bartosz Sosnowski 8 years ago
parent
commit
05ac6e1b01
  1. 4
      benchmark/buffers/buffer-compare-instance-method.js
  2. 23
      benchmark/buffers/buffer-compare-offset.js
  3. 5
      benchmark/buffers/buffer-swap.js

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

@ -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);

23
benchmark/buffers/buffer-compare-offset.js

@ -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++)

5
benchmark/buffers/buffer-swap.js

@ -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);

Loading…
Cancel
Save