-
Notifications
You must be signed in to change notification settings - Fork 109
Provide a single, default, performant and stable regex implementation #615
Comments
As far as I investigated, if we wanna get better performance than std. regex library we cannot avoid cgo.
I'm sorry, but no way to use hyperscan (IMO)! |
Maybe: https://github.com/linyows/go-onigmo ? |
Actually it turned out that installing hyperscan is not that hard (so far, but the latest version 5+ is important. version 4 doesn't work with go wrapper): Debian
OSX
After that go bindings are getable:
|
If you care about regexp performance you should probably limit yourself to engines that do not support non-regular language features like backreferences, unbounded lookahead, and so on. If Go's native package isn't fast enough, I'd suggest considering RE2 (on which it's based). You would indeed need to use cgo or SWIG for that, but if performance counts that may be worth it. Is there a particular benchmark you're trying to improve upon? |
We considered many libraries. Recently we integrated oniguruma, but it's not maintainable anymore. So now, I want to play with Intel's hyperscan which looks even faster than Google's re2 |
That's why I was curious about what benchmarks you're using: If your queries have a very particular structure, or are constrained in some way, it's often possible to do better with one engine than another. |
Regex is mainly used for |
I think the That said: Having gone down this path before, I recommend being skeptical of general-purpose regexp benchmarks. Matchers are incredibly sensitive to workload, so if you have (or can produce) a workload that looks like your production use cases, that will give you a better evaluation. |
Take into account that we have also |
Find a good regex implementation that will be used as a default. The usage of golang regex should be configurable from session variables.
The text was updated successfully, but these errors were encountered: