/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v20.20.2
benchmark/path/resolve-posix.js
30 строк
619 B
Antoine du Hamel
benchmark: add trailing commas in `benchmark/path`
14 фев 2023, 20:09
Не верифицирован
14 фев 2023, 20:09
3acdeb1
Код
Авторство
О чём код?
'use strict'; const common = require('../common.js'); const { posix } = require('path'); const bench = common.createBenchmark(main, { paths: [ '', ['', ''].join('|'), ['foo/bar', '/tmp/file/', '..', 'a/../subfile'].join('|'), ['a/b/c/', '../../..'].join('|'), ], n: [1e5], }); function main({ n, paths }) { const args = paths.split('|'); const copy = [...args]; const orig = copy[0]; bench.start(); for (let i = 0; i < n; i++) { if (i % 3 === 0) { copy[0] = `${orig}${i}`; posix.resolve(...copy); } else { posix.resolve(...args); } } bench.end(n); }