-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
regex-dna with &[u8] matching #31
Comments
Yeah, I noticed this a few weeks ago and though it was curious. I actually can't think of any obvious reason why it's slower. My (more extensive) benchmark suite says Another thing you could try is |
Ahahahahaha. This is because |
OK, once I fixed that in |
This was using `Vec::extend` to accumulate bytes in a buffer, but this compiles down to less efficient code than, say, `Vec::extend_from_slice`. However, that method is newly available as of Rust 1.6, so we do a small backport to regain performance. This bug was noticed by @llogiq here: TeXitoi/benchmarksgame-rs#31 In particular, this increases the performance of bytes::Regex two-fold on that benchmark.
Ok then I'm going to wait for a new Regex release so I can submit it without complicating our makefile. Thanks @BurntSushi! |
I have a gist where I use
regex::bytes
instead of plainregex
. I'd have thought that it should be faster (because we can get rid of the UTF-8 check), but in fact it is slower. @BurntSushi there's probably some reason for that, just a heads-up; if the bytes variant should get faster we can retry the measurements.On my system:
The text was updated successfully, but these errors were encountered: