2016-02-20 02:03:16 +01:00
|
|
|
'use strict';
|
2015-06-06 02:43:48 +02:00
|
|
|
var common = require('../common.js');
|
|
|
|
var path = require('path');
|
|
|
|
|
|
|
|
var bench = common.createBenchmark(main, {
|
2016-02-06 04:23:29 +01:00
|
|
|
paths: [
|
|
|
|
'',
|
|
|
|
['', ''].join('|'),
|
|
|
|
['foo/bar', '/tmp/file/', '..', 'a/../subfile'].join('|'),
|
|
|
|
['a/b/c/', '../../..'].join('|')
|
|
|
|
],
|
|
|
|
n: [1e6]
|
2015-06-06 02:43:48 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
function main(conf) {
|
|
|
|
var n = +conf.n;
|
2016-02-06 04:23:29 +01:00
|
|
|
var p = path.posix;
|
2017-04-17 03:01:12 +02:00
|
|
|
var args = String(conf.paths).split('|');
|
2015-06-06 02:43:48 +02:00
|
|
|
|
|
|
|
bench.start();
|
|
|
|
for (var i = 0; i < n; i++) {
|
2016-02-06 04:23:29 +01:00
|
|
|
p.resolve.apply(null, args);
|
2015-06-06 02:43:48 +02:00
|
|
|
}
|
|
|
|
bench.end(n);
|
|
|
|
}
|