/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
benchmark/path/dirname-posix.js
24 строки
423 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, { path: [ '', '/', '/foo', '/foo/bar', 'foo', 'foo/bar', '/foo/bar/baz/asdf/quux', ], n: [1e5], }); function main({ n, path }) { bench.start(); for (let i = 0; i < n; i++) { posix.dirname(i % 3 === 0 ? `${path}${i}` : path); } bench.end(n); }