-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[DRAFT] - Test using re2 regex pkg in place of std regex #1542
Conversation
@ahrav have you seen https://github.com/go-enry/go-oniguruma? I played around with introducing this into gitleaks once upon a time and the results were very impressive. This was before |
Ohhhh, wow. I did not see this at all. Yea I can definitely give this a spin. Thanks for pointing it out. |
@zricethezav added some benchmarks after i did some testing w/ oniguruma and re2. |
@ahrav Based on what I'm seeing looks like re2 wins out right? That's good news since onigurama would require some |
Yep that's right. You are correct I had to set the CGO flags when testing oniguruma as well which wasn't great. The re2 change is a pretty nice and easy drop in and replace. |
Since it's API compatible w/ go's regexp I think we could just consider doing a go mod replace directive. |
I don't think you can go mod replace a std lib pkg. I could be wrong though. |
I do wonder with this more efficient regex engine, could we explore a larger chunk size? |
Closing because #2324 |
Some benchmarks testing go std lib regex, vs re2 vs oniguruma.
re2 - https://github.com/wasilibs/go-re2
oniguruma - https://github.com/go-enry/go-oniguruma
old.txt -> go std lib
new.txt -> oniguruma
newest.txt -> re2 (too brain dead to name it better lol)
go vs oniguruma
go vs re2
oniguruma vs re2