0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 23:43:09 +01:00
nodejs/benchmark/path/join.js
Nathan Woltman 0d15161c24 benchmark: Add some path benchmarks for #1778
Path functions being benchmarked are:
* format
* isAbsolute
* join
* normalize
* relative
* resolve

PR-URL: https://github.com/nodejs/io.js/pull/1778
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-07-04 13:30:20 +02:00

19 lines
352 B
JavaScript

var common = require('../common.js');
var path = require('path');
var bench = common.createBenchmark(main, {
type: ['win32', 'posix'],
n: [1e6],
});
function main(conf) {
var n = +conf.n;
var p = path[conf.type];
bench.start();
for (var i = 0; i < n; i++) {
p.join('/foo', 'bar', '', 'baz/asdf', 'quux', '..');
}
bench.end(n);
}