mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-03-17 20:28:03 +02:00
In the time before, we just used a RegexSet from the regex crate. That allocated unconditionally, so there was nothing we could do and it didn't expose any APIs to reuse that memory. But now that we're using the lower level regex-automata, we can reuse a PatternSet. Ideally we would just provide a way for the caller to build a PatternSet (perhaps via an opaque type) so that we don't have to shuffle data into a PatternSet and then back into the caller's `Vec<usize>`. But this at least avoids allocating for every search.