benchmark: remove forced optimization from misc
This removes all instances of %OptimizeFunctionOnNextCall from misc 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>
This commit is contained in:
parent
ef8cc301fe
commit
7587a11adc
@ -4,9 +4,6 @@ const common = require('../common.js');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const Writable = require('stream').Writable;
|
const Writable = require('stream').Writable;
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const v8 = require('v8');
|
|
||||||
|
|
||||||
v8.setFlagsFromString('--allow_natives_syntax');
|
|
||||||
|
|
||||||
const methods = [
|
const methods = [
|
||||||
'restAndSpread',
|
'restAndSpread',
|
||||||
@ -51,14 +48,7 @@ function usingArgumentsAndApplyC() {
|
|||||||
nullStream.write(util.format.apply(null, arguments) + '\n');
|
nullStream.write(util.format.apply(null, arguments) + '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
function optimize(method, ...args) {
|
|
||||||
method(...args);
|
|
||||||
eval(`%OptimizeFunctionOnNextCall(${method.name})`);
|
|
||||||
method(...args);
|
|
||||||
}
|
|
||||||
|
|
||||||
function runUsingRestAndConcat(n) {
|
function runUsingRestAndConcat(n) {
|
||||||
optimize(usingRestAndConcat, 'a', 1);
|
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
bench.start();
|
bench.start();
|
||||||
@ -70,7 +60,6 @@ function runUsingRestAndConcat(n) {
|
|||||||
function runUsingRestAndSpread(n, concat) {
|
function runUsingRestAndSpread(n, concat) {
|
||||||
|
|
||||||
const method = concat ? usingRestAndSpreadC : usingRestAndSpreadTS;
|
const method = concat ? usingRestAndSpreadC : usingRestAndSpreadTS;
|
||||||
optimize(method, 'this is %s of %d', 'a', 1);
|
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
bench.start();
|
bench.start();
|
||||||
@ -82,7 +71,6 @@ function runUsingRestAndSpread(n, concat) {
|
|||||||
function runUsingRestAndApply(n, concat) {
|
function runUsingRestAndApply(n, concat) {
|
||||||
|
|
||||||
const method = concat ? usingRestAndApplyC : usingRestAndApplyTS;
|
const method = concat ? usingRestAndApplyC : usingRestAndApplyTS;
|
||||||
optimize(method, 'this is %s of %d', 'a', 1);
|
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
bench.start();
|
bench.start();
|
||||||
@ -94,7 +82,6 @@ function runUsingRestAndApply(n, concat) {
|
|||||||
function runUsingArgumentsAndApply(n, concat) {
|
function runUsingArgumentsAndApply(n, concat) {
|
||||||
|
|
||||||
const method = concat ? usingArgumentsAndApplyC : usingArgumentsAndApplyTS;
|
const method = concat ? usingArgumentsAndApplyC : usingArgumentsAndApplyTS;
|
||||||
optimize(method, 'this is %s of %d', 'a', 1);
|
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
bench.start();
|
bench.start();
|
||||||
|
@ -42,8 +42,9 @@ function usingICU(val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function runPunycode(n, val) {
|
function runPunycode(n, val) {
|
||||||
common.v8ForceOptimization(usingPunycode, val);
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
for (; i < n; i++)
|
||||||
|
usingPunycode(val);
|
||||||
bench.start();
|
bench.start();
|
||||||
for (; i < n; i++)
|
for (; i < n; i++)
|
||||||
usingPunycode(val);
|
usingPunycode(val);
|
||||||
@ -51,7 +52,6 @@ function runPunycode(n, val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function runICU(n, val) {
|
function runICU(n, val) {
|
||||||
common.v8ForceOptimization(usingICU, val);
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
bench.start();
|
bench.start();
|
||||||
for (; i < n; i++)
|
for (; i < n; i++)
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
const common = require('../common.js');
|
const common = require('../common.js');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const v8 = require('v8');
|
|
||||||
|
|
||||||
const bench = common.createBenchmark(main, {
|
const bench = common.createBenchmark(main, {
|
||||||
type: ['extend', 'assign'],
|
type: ['extend', 'assign'],
|
||||||
@ -12,15 +11,11 @@ const bench = common.createBenchmark(main, {
|
|||||||
function main(conf) {
|
function main(conf) {
|
||||||
let fn;
|
let fn;
|
||||||
const n = conf.n | 0;
|
const n = conf.n | 0;
|
||||||
let v8command;
|
|
||||||
|
|
||||||
if (conf.type === 'extend') {
|
if (conf.type === 'extend') {
|
||||||
fn = util._extend;
|
fn = util._extend;
|
||||||
v8command = '%OptimizeFunctionOnNextCall(util._extend)';
|
|
||||||
} else if (conf.type === 'assign') {
|
} else if (conf.type === 'assign') {
|
||||||
fn = Object.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
|
// Force-optimize the method to test so that the benchmark doesn't
|
||||||
@ -28,9 +23,6 @@ function main(conf) {
|
|||||||
for (var i = 0; i < conf.type.length * 10; i += 1)
|
for (var i = 0; i < conf.type.length * 10; i += 1)
|
||||||
fn({}, process.env);
|
fn({}, process.env);
|
||||||
|
|
||||||
v8.setFlagsFromString('--allow_natives_syntax');
|
|
||||||
eval(v8command);
|
|
||||||
|
|
||||||
var obj = new Proxy({}, { set: function(a, b, c) { return true; } });
|
var obj = new Proxy({}, { set: function(a, b, c) { return true; } });
|
||||||
|
|
||||||
bench.start();
|
bench.start();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user