diff options
author | Andrew Gallant <jamslam@gmail.com> | 2019-04-05 21:02:47 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2019-04-05 23:24:08 -0400 |
commit | 9f15e3b671d64efa261f6de0fd4c6c06e0caa21c (patch) | |
tree | 587d0dcb9a62eabe31c83ea529920cb5d2b9c2cc /grep-regex/src/word.rs | |
parent | 254b8b67bbe0245a2f117c030d2c10a2dde2ed46 (diff) |
regex: fix a perf bug when using -w flag
When looking for an inner literal to speed up searches, if only a prefix
is found, then we generally give up doing inner literal optimizations since
the regex engine will generally handle it for us. Unfortunately, this
decision was being made *before* we wrap the regex in (^|\W)...($|\W) when
using the -w/--word-regexp flag, which would then defeat the literal
optimizations inside the regex engine.
We fix this with a bit of a hack that says, "if we're doing a word regexp,
then give me back any literal you find, even if it's a prefix."
Diffstat (limited to 'grep-regex/src/word.rs')
0 files changed, 0 insertions, 0 deletions