• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common.js');
3const { win32 } = require('path');
4
5const bench = common.createBenchmark(main, {
6  paths: [
7    ['C:\\foo', 'bar', '', 'baz\\asdf', 'quux', '..'].join('|'),
8  ],
9  n: [1e5],
10});
11
12function main({ n, paths }) {
13  const args = paths.split('|');
14  const copy = [...args];
15  const orig = copy[1];
16
17  bench.start();
18  for (let i = 0; i < n; i++) {
19    if (i % 3 === 0) {
20      copy[1] = `${orig}${i}`;
21      win32.join(...copy);
22    } else {
23      win32.join(...args);
24    }
25  }
26  bench.end(n);
27}
28