11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common.js'); 31cb0ef41Sopenharmony_ciconst { win32 } = require('path'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst bench = common.createBenchmark(main, { 61cb0ef41Sopenharmony_ci paths: [ 71cb0ef41Sopenharmony_ci '', 81cb0ef41Sopenharmony_ci ['', ''].join('|'), 91cb0ef41Sopenharmony_ci ['c:/ignore', 'd:\\a/b\\c/d', '\\e.exe'].join('|'), 101cb0ef41Sopenharmony_ci ['c:/blah\\blah', 'd:/games', 'c:../a'].join('|'), 111cb0ef41Sopenharmony_ci ], 121cb0ef41Sopenharmony_ci n: [1e5], 131cb0ef41Sopenharmony_ci}); 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_cifunction main({ n, paths }) { 161cb0ef41Sopenharmony_ci const args = paths.split('|'); 171cb0ef41Sopenharmony_ci const copy = [...args]; 181cb0ef41Sopenharmony_ci const orig = copy[0]; 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ci bench.start(); 211cb0ef41Sopenharmony_ci for (let i = 0; i < n; i++) { 221cb0ef41Sopenharmony_ci if (i % 3 === 0) { 231cb0ef41Sopenharmony_ci copy[0] = `${orig}${i}`; 241cb0ef41Sopenharmony_ci win32.resolve(...copy); 251cb0ef41Sopenharmony_ci } else { 261cb0ef41Sopenharmony_ci win32.resolve(...args); 271cb0ef41Sopenharmony_ci } 281cb0ef41Sopenharmony_ci } 291cb0ef41Sopenharmony_ci bench.end(n); 301cb0ef41Sopenharmony_ci} 31