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
|
|
|
path: [
|
|
|
|
'',
|
|
|
|
'.',
|
|
|
|
'C:\\..\\',
|
|
|
|
'C:\\foo',
|
|
|
|
'C:\\foo\\bar',
|
|
|
|
'C:\\foo\\bar\\\\baz\\asdf\\quux\\..'
|
|
|
|
],
|
|
|
|
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.win32;
|
2017-04-17 03:01:12 +02:00
|
|
|
var input = String(conf.path);
|
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.normalize(input);
|
2015-06-06 02:43:48 +02:00
|
|
|
}
|
|
|
|
bench.end(n);
|
|
|
|
}
|