Skip to content

Commit

Permalink
benchmark: remove forced optimization from path
Browse files Browse the repository at this point in the history
This removes all instances of %OptimizeFunctionOnNextCall from path
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 6, 2017
1 parent 7587a11 commit eba2c62
Show file tree
Hide file tree
Showing 21 changed files with 17 additions and 150 deletions.
7 changes: 0 additions & 7 deletions benchmark/path/basename-posix.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
pathext: [
Expand Down Expand Up @@ -30,12 +29,6 @@ function main(conf) {
input = input.slice(0, extIdx);
}

// Force optimization before starting the benchmark
p.basename(input, ext);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.basename)');
p.basename(input, ext);

bench.start();
for (var i = 0; i < n; i++) {
p.basename(input, ext);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/basename-win32.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
pathext: [
Expand Down Expand Up @@ -30,12 +29,6 @@ function main(conf) {
input = input.slice(0, extIdx);
}

// Force optimization before starting the benchmark
p.basename(input, ext);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.basename)');
p.basename(input, ext);

bench.start();
for (var i = 0; i < n; i++) {
p.basename(input, ext);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/dirname-posix.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
path: [
Expand All @@ -21,12 +20,6 @@ function main(conf) {
var p = path.posix;
var input = '' + conf.path;

// Force optimization before starting the benchmark
p.dirname(input);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.dirname)');
p.dirname(input);

bench.start();
for (var i = 0; i < n; i++) {
p.dirname(input);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/dirname-win32.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
path: [
Expand All @@ -21,12 +20,6 @@ function main(conf) {
var p = path.win32;
var input = '' + conf.path;

// Force optimization before starting the benchmark
p.dirname(input);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.dirname)');
p.dirname(input);

bench.start();
for (var i = 0; i < n; i++) {
p.dirname(input);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/extname-posix.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
path: [
Expand All @@ -24,12 +23,6 @@ function main(conf) {
var p = path.posix;
var input = '' + conf.path;

// Force optimization before starting the benchmark
p.extname(input);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.extname)');
p.extname(input);

bench.start();
for (var i = 0; i < n; i++) {
p.extname(input);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/extname-win32.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
path: [
Expand All @@ -24,12 +23,6 @@ function main(conf) {
var p = path.win32;
var input = '' + conf.path;

// Force optimization before starting the benchmark
p.extname(input);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.extname)');
p.extname(input);

bench.start();
for (var i = 0; i < n; i++) {
p.extname(input);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/format-posix.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
props: [
Expand All @@ -22,12 +21,6 @@ function main(conf) {
name: props[4] || '',
};

// Force optimization before starting the benchmark
p.format(obj);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.format)');
p.format(obj);

bench.start();
for (var i = 0; i < n; i++) {
p.format(obj);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/format-win32.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
props: [
Expand All @@ -22,12 +21,6 @@ function main(conf) {
name: props[4] || '',
};

// Force optimization before starting the benchmark
p.format(obj);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.format)');
p.format(obj);

bench.start();
for (var i = 0; i < n; i++) {
p.format(obj);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/isAbsolute-posix.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
path: [
Expand All @@ -19,12 +18,6 @@ function main(conf) {
var p = path.posix;
var input = '' + conf.path;

// Force optimization before starting the benchmark
p.isAbsolute(input);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.isAbsolute)');
p.isAbsolute(input);

bench.start();
for (var i = 0; i < n; i++) {
p.isAbsolute(input);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/isAbsolute-win32.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
path: [
Expand All @@ -20,12 +19,6 @@ function main(conf) {
var p = path.win32;
var input = '' + conf.path;

// Force optimization before starting the benchmark
p.isAbsolute(input);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.isAbsolute)');
p.isAbsolute(input);

bench.start();
for (var i = 0; i < n; i++) {
p.isAbsolute(input);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/join-posix.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
paths: [
Expand All @@ -15,12 +14,6 @@ function main(conf) {
var p = path.posix;
var args = ('' + conf.paths).split('|');

// Force optimization before starting the benchmark
p.join.apply(null, args);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.join)');
p.join.apply(null, args);

bench.start();
for (var i = 0; i < n; i++) {
p.join.apply(null, args);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/join-win32.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
paths: [
Expand All @@ -15,12 +14,6 @@ function main(conf) {
var p = path.win32;
var args = ('' + conf.paths).split('|');

// Force optimization before starting the benchmark
p.join.apply(null, args);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.join)');
p.join.apply(null, args);

bench.start();
for (var i = 0; i < n; i++) {
p.join.apply(null, args);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/makeLong-win32.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
path: [
Expand All @@ -18,12 +17,6 @@ function main(conf) {
var p = path.win32;
var input = '' + conf.path;

// Force optimization before starting the benchmark
p._makeLong(input);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p._makeLong)');
p._makeLong(input);

bench.start();
for (var i = 0; i < n; i++) {
p._makeLong(input);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/normalize-posix.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
path: [
Expand All @@ -20,12 +19,6 @@ function main(conf) {
var p = path.posix;
var input = '' + conf.path;

// Force optimization before starting the benchmark
p.normalize(input);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.normalize)');
p.normalize(input);

bench.start();
for (var i = 0; i < n; i++) {
p.normalize(input);
Expand Down
7 changes: 0 additions & 7 deletions benchmark/path/normalize-win32.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
path: [
Expand All @@ -20,12 +19,6 @@ function main(conf) {
var p = path.win32;
var input = '' + conf.path;

// Force optimization before starting the benchmark
p.normalize(input);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.normalize)');
p.normalize(input);

bench.start();
for (var i = 0; i < n; i++) {
p.normalize(input);
Expand Down
12 changes: 4 additions & 8 deletions benchmark/path/parse-posix.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
path: [
Expand All @@ -21,15 +20,12 @@ function main(conf) {
var p = path.posix;
var input = '' + conf.path;

// Force optimization before starting the benchmark
p.parse(input);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.parse)');
p.parse(input);

bench.start();
for (var i = 0; i < n; i++) {
p.parse(input);
}
bench.start();
for (i = 0; i < n; i++) {
p.parse(input);
}
bench.end(n);
}
12 changes: 4 additions & 8 deletions benchmark/path/parse-win32.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
path: [
Expand All @@ -22,15 +21,12 @@ function main(conf) {
var p = path.win32;
var input = '' + conf.path;

// Force optimization before starting the benchmark
p.parse(input);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.parse)');
p.parse(input);

bench.start();
for (var i = 0; i < n; i++) {
p.parse(input);
}
bench.start();
for (i = 0; i < n; i++) {
p.parse(input);
}
bench.end(n);
}
12 changes: 4 additions & 8 deletions benchmark/path/relative-posix.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
var common = require('../common.js');
var path = require('path');
var v8 = require('v8');

var bench = common.createBenchmark(main, {
paths: [
Expand All @@ -26,15 +25,12 @@ function main(conf) {
to = from.slice(delimIdx + 1);
from = from.slice(0, delimIdx);
}

// Force optimization before starting the benchmark
p.relative(from, to);
v8.setFlagsFromString('--allow_natives_syntax');
eval('%OptimizeFunctionOnNextCall(p.relative)');
p.relative(from, to);
for (var i = 0; i < n; i++) {
p.relative(from, to);
}

bench.start();
for (var i = 0; i < n; i++) {
for (i = 0; i < n; i++) {
p.relative(from, to);
}
bench.end(n);
Expand Down
Loading

0 comments on commit eba2c62

Please sign in to comment.