/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v20.20.1
benchmark/assert/match.js
21 строка
478 B
RafaelGSS
benchmark: add match and doesNotMatch bench
02 окт 2024, 08:57
Не верифицирован
02 окт 2024, 08:57
4078aa8
Код
Авторство
О чём код?
'use strict'; const common = require('../common.js'); const assert = require('assert'); const bench = common.createBenchmark(main, { n: [25, 2e7], method: ['match', 'doesNotMatch'], }); 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); }