/
niceSOFT
/
python3-pathspec
Обзор
Документация
Войти
/
niceSOFT
/
python3-pathspec
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
benchmarks/bench_gitignore_match_files_p50.py
62 строки
1 KB
Caleb Burns
WIP
09 дек 2025, 07:52
Не верифицирован
09 дек 2025, 07:52
7bb5aae
Код
Авторство
О чём код?
""" This module benchmarks `GitIgnoreSpec.match_files()` using 50 patterns. """ import pytest from pytest_benchmark.fixture import ( BenchmarkFixture) from pathspec import ( GitIgnoreSpec) GROUP = "GitIgnoreSpec.match_files(): 50 lines, 6.5k files" # Hyperscan backend. @pytest.mark.benchmark(group=GROUP) def bench_hs_v1( benchmark: BenchmarkFixture, cpython_files: str, cpython_gi_lines_50: list[str], ): spec = GitIgnoreSpec.from_lines( cpython_gi_lines_50, backend='hyperscan', ) benchmark(run_match, spec, cpython_files) # Re2 backend. @pytest.mark.benchmark(group=GROUP) def bench_re2_v1( benchmark: BenchmarkFixture, cpython_files: str, cpython_gi_lines_50: list[str], ): spec = GitIgnoreSpec.from_lines( cpython_gi_lines_50, backend='re2', ) benchmark(run_match, spec, cpython_files) # Simple backend. @pytest.mark.benchmark(group=GROUP) def bench_sm_v1( benchmark: BenchmarkFixture, cpython_files: str, cpython_gi_lines_50: list[str], ): spec = GitIgnoreSpec.from_lines( cpython_gi_lines_50, backend='simple', ) benchmark(run_match, spec, cpython_files) def run_match(spec: GitIgnoreSpec, files: set[str]): for _ in spec.match_files(files): pass