diff options
author | Andrew Gallant <jamslam@gmail.com> | 2016-09-12 19:35:47 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2016-09-12 19:35:59 -0400 |
commit | f11d9fb9221a8c20452dee82af6429e88a8f2785 (patch) | |
tree | f57fe32a896ee65364759b4c5e4e29fef6f7994a /benchsuite | |
parent | 1115c23a4c6d038eabe129190da0a2b74866d8d0 (diff) |
Add a word benchmark.
Add ag to case insensitive benchmark.
Diffstat (limited to 'benchsuite')
-rwxr-xr-x | benchsuite | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -476,6 +476,7 @@ def bench_subtitles_ru_literal_casei(suite_dir): return Benchmark(pattern=pat, commands=[ Command('rg', ['rg', '-n', '-i', pat, ru]), + Command('ag (not Unicode)', ['ag', '-i', pat, ru]), Command('ucg (not Unicode)', ['ucg', '-i', pat, ru]), Command('grep', ['grep', '-ani', pat, ru], env=GREP_UNICODE), Command('grep (not Unicode)', [ @@ -484,6 +485,28 @@ def bench_subtitles_ru_literal_casei(suite_dir): ]) +def bench_subtitles_ru_literal_word(suite_dir): + ''' + Benchmark the speed of finding a literal inside word boundaries. + ''' + require(suite_dir, 'subtitles-ru') + ru = path.join(suite_dir, SUBTITLES_DIR, SUBTITLES_RU_NAME) + pat = 'Шерлок Холмс' # Sherlock Holmes + + return Benchmark(pattern=pat, commands=[ + Command('rg', ['rg', '-nw', pat, ru]), + Command('rg (not Unicode)', [ + 'rg', '-n', r'(?-u:\b)' + pat + r'(?-u:\b)', ru, + ]), + Command('ag (not Unicode)', ['ag', '-sw', pat, ru]), + Command('ucg (not Unicode)', ['ucg', '--nosmart-case', pat, ru]), + Command('grep (not Unicode)', [ + 'grep', '-anw', pat, ru, + ], env=GREP_ASCII), + Command('grep', ['grep', '-anw', pat, ru], env=GREP_UNICODE), + ]) + + def bench_subtitles_ru_alternate(suite_dir): ''' Benchmark the speed of a set of alternate literals. |