2016-02-20 01:03:16 +00:00
|
|
|
'use strict';
|
2017-09-14 01:48:53 +00:00
|
|
|
const common = require('../common.js');
|
2017-12-30 02:57:01 +00:00
|
|
|
const { win32 } = require('path');
|
2015-07-04 19:50:07 +00:00
|
|
|
|
2017-09-14 01:48:53 +00:00
|
|
|
const bench = common.createBenchmark(main, {
|
2016-02-06 03:23:29 +00:00
|
|
|
path: [
|
|
|
|
'',
|
|
|
|
'C:\\',
|
|
|
|
'C:\\foo',
|
|
|
|
'\\foo',
|
|
|
|
'E:\\foo\\bar.baz',
|
|
|
|
'foo\\.bar.baz',
|
|
|
|
'foo\\bar',
|
2019-02-05 06:06:08 +00:00
|
|
|
'\\foo\\bar\\baz\\asdf\\.quux',
|
2016-02-06 03:23:29 +00:00
|
|
|
],
|
2023-02-14 17:09:42 +00:00
|
|
|
n: [1e5],
|
2015-07-04 19:50:07 +00:00
|
|
|
});
|
|
|
|
|
2017-12-30 02:57:01 +00:00
|
|
|
function main({ n, path }) {
|
2017-03-01 11:37:12 +00:00
|
|
|
bench.start();
|
2018-12-29 23:26:36 +00:00
|
|
|
for (let i = 0; i < n; i++) {
|
|
|
|
win32.parse(i % 3 === 0 ? `${path}${i}` : path);
|
2017-03-01 11:37:12 +00:00
|
|
|
}
|
2015-07-04 19:50:07 +00:00
|
|
|
bench.end(n);
|
|
|
|
}
|