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