Skip to content

Commit

Permalink
benchmark: remove forced optimization from misc
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
bzoz committed Mar 6, 2017
1 parent ef8cc30 commit 7587a11
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 23 deletions.
13 changes: 0 additions & 13 deletions benchmark/misc/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ const common = require('../common.js');
const assert = require('assert');
const Writable = require('stream').Writable;
const util = require('util');
const v8 = require('v8');

v8.setFlagsFromString('--allow_natives_syntax');

const methods = [
'restAndSpread',
Expand Down Expand Up @@ -51,14 +48,7 @@ function usingArgumentsAndApplyC() {
nullStream.write(util.format.apply(null, arguments) + '\n');
}

function optimize(method, ...args) {
method(...args);
eval(`%OptimizeFunctionOnNextCall(${method.name})`);
method(...args);
}

function runUsingRestAndConcat(n) {
optimize(usingRestAndConcat, 'a', 1);

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

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

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

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

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

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

var i = 0;
bench.start();
Expand Down
4 changes: 2 additions & 2 deletions benchmark/misc/punycode.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ function usingICU(val) {
}

function runPunycode(n, val) {
common.v8ForceOptimization(usingPunycode, val);
var i = 0;
for (; i < n; i++)
usingPunycode(val);
bench.start();
for (; i < n; i++)
usingPunycode(val);
bench.end(n);
}

function runICU(n, val) {
common.v8ForceOptimization(usingICU, val);
var i = 0;
bench.start();
for (; i < n; i++)
Expand Down
8 changes: 0 additions & 8 deletions benchmark/misc/util-extend-vs-object-assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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

const bench = common.createBenchmark(main, {
type: ['extend', 'assign'],
Expand All @@ -12,25 +11,18 @@ const bench = common.createBenchmark(main, {
function main(conf) {
let fn;
const n = conf.n | 0;
let v8command;

if (conf.type === 'extend') {
fn = util._extend;
v8command = '%OptimizeFunctionOnNextCall(util._extend)';
} else if (conf.type === 'assign') {
fn = Object.assign;
// Object.assign is built-in, cannot be optimized
v8command = '';
}

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

v8.setFlagsFromString('--allow_natives_syntax');
eval(v8command);

var obj = new Proxy({}, { set: function(a, b, c) { return true; } });

bench.start();
Expand Down

0 comments on commit 7587a11

Please sign in to comment.