/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v22.23.2
benchmark/assert/match.js
28 строк
703 B
Ruben Bridgewater
benchmark: skip running some assert benchmarks by default
17 апр 2025, 16:51
Не верифицирован
17 апр 2025, 16:51
b20b369
Код
Авторство
О чём код?
'use strict'; const common = require('../common.js'); const assert = require('assert'); const bench = common.createBenchmark(main, { n: [2e7], method: ['match', 'doesNotMatch'], }, { combinationFilter(p) { // These benchmarks purposefully do not run by default. They do not provide // might insight, due to only being a small wrapper around a native regexp // call. return p.n === 1; }, }); function main({ n, method }) { const fn = assert[method]; const actual = 'Example of string that will match'; const expected = method === 'match' ? /will match/ : /will not match/; bench.start(); for (let i = 0; i < n; ++i) { fn(actual, expected); } bench.end(n); }