1'use strict';
2const common = require('../common.js');
3const { win32 } = require('path');
4
5const bench = common.createBenchmark(main, {
6  path: [
7    '',
8    '\\',
9    '\\foo',
10    'C:\\foo\\bar',
11    'foo',
12    'foo\\bar',
13    'D:\\foo\\bar\\baz\\asdf\\quux',
14  ],
15  n: [1e5],
16});
17
18function main({ n, path }) {
19  bench.start();
20  for (let i = 0; i < n; i++) {
21    win32.dirname(i % 3 === 0 ? `${path}${i}` : path);
22  }
23  bench.end(n);
24}
25