Permalink
Browse files

benchmark: remove forced optimization from misc

This removes all instances of %OptimizeFunctionOnNextCall from misc
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 Mar 1, 2017
1 parent ef8cc30 commit 7587a11adc5013721aae3e0bedb7fbd51e1ced5b
Showing with 2 additions and 23 deletions.
  1. +0 −13 benchmark/misc/console.js
  2. +2 −2 benchmark/misc/punycode.js
  3. +0 −8 benchmark/misc/util-extend-vs-object-assign.js
View
@@ -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',
@@ -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();
@@ -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();
@@ -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();
@@ -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();
@@ -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++)
@@ -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'],
@@ -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();

0 comments on commit 7587a11

Please sign in to comment.