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

Tweak regex to reduce backtracking #4

merged 1 commit into from Nov 19, 2018


None yet
2 participants
Copy link

wezm commented Oct 29, 2018

Running the tool under perf <regex::backtrack::Bounded<'a, 'm, 'r, 's, I>>::backtrack is often near the top of the profile. As result I tweaked one of the regexes to be a little more specific and hopefully reduce backtracking.


test user_agent::tests::bench_parse ... bench: 46,954 ns/iter (+/- 883)


test user_agent::tests::bench_parse ... bench: 32,635 ns/iter (+/- 936)

@indirect indirect merged commit 0fa0bb7 into rubytogether:main Nov 19, 2018


This comment has been minimized.

Copy link

indirect commented Nov 19, 2018

Thanks! This made a small but seemingly measurable impact on the overall speed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment