-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit splits each path benchmark into separate posix and Windows benchmark files. This allows benchmarking (platform-)specific inputs against specific platforms (only). PR-URL: #5123 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: James M Snell <[email protected]>
- Loading branch information
Showing
24 changed files
with
592 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
var common = require('../common.js'); | ||
var path = require('path'); | ||
var v8 = require('v8'); | ||
|
||
var bench = common.createBenchmark(main, { | ||
pathext: [ | ||
'', | ||
'/', | ||
'/foo', | ||
'/foo/.bar.baz', | ||
['/foo/.bar.baz', '.baz'].join('|'), | ||
'foo', | ||
'foo/bar.', | ||
['foo/bar.', '.'].join('|'), | ||
'/foo/bar/baz/asdf/quux.html', | ||
['/foo/bar/baz/asdf/quux.html', '.html'].join('|') | ||
], | ||
n: [1e6] | ||
}); | ||
|
||
function main(conf) { | ||
var n = +conf.n; | ||
var p = path.posix; | ||
var input = '' + conf.pathext; | ||
var ext; | ||
var extIdx = input.indexOf('|'); | ||
if (extIdx !== -1) { | ||
ext = input.slice(extIdx + 1); | ||
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); | ||
} | ||
bench.end(n); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
var common = require('../common.js'); | ||
var path = require('path'); | ||
var v8 = require('v8'); | ||
|
||
var bench = common.createBenchmark(main, { | ||
pathext: [ | ||
'', | ||
'C:\\', | ||
'C:\\foo', | ||
'D:\\foo\\.bar.baz', | ||
['E:\\foo\\.bar.baz','.baz'].join('|'), | ||
'foo', | ||
'foo\\bar.', | ||
['foo\\bar.', '.'].join('|'), | ||
'\\foo\\bar\\baz\\asdf\\quux.html', | ||
['\\foo\\bar\\baz\\asdf\\quux.html', '.html'].join('|') | ||
], | ||
n: [1e6] | ||
}); | ||
|
||
function main(conf) { | ||
var n = +conf.n; | ||
var p = path.win32; | ||
var input = '' + conf.pathext; | ||
var ext; | ||
var extIdx = input.indexOf('|'); | ||
if (extIdx !== -1) { | ||
ext = input.slice(extIdx + 1); | ||
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); | ||
} | ||
bench.end(n); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
var common = require('../common.js'); | ||
var path = require('path'); | ||
var v8 = require('v8'); | ||
|
||
var bench = common.createBenchmark(main, { | ||
path: [ | ||
'', | ||
'\\', | ||
'\\foo', | ||
'C:\\foo\\bar', | ||
'foo', | ||
'foo\\bar', | ||
'D:\\foo\\bar\\baz\\asdf\\quux' | ||
], | ||
n: [1e6] | ||
}); | ||
|
||
function main(conf) { | ||
var n = +conf.n; | ||
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); | ||
} | ||
bench.end(n); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
var common = require('../common.js'); | ||
var path = require('path'); | ||
var v8 = require('v8'); | ||
|
||
var bench = common.createBenchmark(main, { | ||
path: [ | ||
'', | ||
'/', | ||
'/foo', | ||
'foo/.bar.baz', | ||
'index.html', | ||
'index', | ||
'foo/bar/..baz.quux', | ||
'foo/bar/...baz.quux', | ||
'/foo/bar/baz/asdf/quux', | ||
'/foo/bar/baz/asdf/quux.foobarbazasdfquux' | ||
], | ||
n: [1e6] | ||
}); | ||
|
||
function main(conf) { | ||
var n = +conf.n; | ||
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); | ||
} | ||
bench.end(n); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
var common = require('../common.js'); | ||
var path = require('path'); | ||
var v8 = require('v8'); | ||
|
||
var bench = common.createBenchmark(main, { | ||
path: [ | ||
'', | ||
'\\', | ||
'C:\\foo', | ||
'foo\\.bar.baz', | ||
'index.html', | ||
'index', | ||
'foo\\bar\\..baz.quux', | ||
'foo\\bar\\...baz.quux', | ||
'D:\\foo\\bar\\baz\\asdf\\quux', | ||
'\\foo\\bar\\baz\\asdf\\quux.foobarbazasdfquux' | ||
], | ||
n: [1e6] | ||
}); | ||
|
||
function main(conf) { | ||
var n = +conf.n; | ||
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); | ||
} | ||
bench.end(n); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
var common = require('../common.js'); | ||
var path = require('path'); | ||
var v8 = require('v8'); | ||
|
||
var bench = common.createBenchmark(main, { | ||
props: [ | ||
['C:\\', 'C:\\path\\dir', 'index.html', '.html', 'index'].join('|') | ||
], | ||
n: [1e7] | ||
}); | ||
|
||
function main(conf) { | ||
var n = +conf.n; | ||
var p = path.win32; | ||
var props = ('' + conf.props).split('|'); | ||
var obj = { | ||
root: props[0] || '', | ||
dir: props[1] || '', | ||
base: props[2] || '', | ||
ext: props[3] || '', | ||
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); | ||
} | ||
bench.end(n); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.