News for hackers. Stuff that matters.
Re:Go performance from version 1.2 to 1.18 by catlifeonmars on Thursday February 03, 2022 @09:50PM (#30202206)
One of our ACLs at work relies heavily on Go regexp. The performance of evaluation is actually not too bad. What is quite terrible is the performance of *compiling* regexps.
Re:Go performance from version 1.2 to 1.18 by benhoyt on Thursday February 03, 2022 @10:09PM (#30202351)
I find this a bit surprising -- do you have numbers? Though even if compiling them is relatively slow it doesn't matter too much, because usually you're compiling once and evaluating many many times (e.g., in the case of a typical AWK script, you compile once and evaluate for each line in the input).
Re:Go performance from version 1.2 to 1.18 by catlifeonmars on Friday February 04, 2022 @03:30AM (#30204249)
https://gist.github.com/jncornett/4a908250d701aec52a11d61a89...

This is not super surprising, and like you said, in a typical AWK script you would only need to compile once.

In short:

$ go test -bench .

...

BenchmarkRegexpCompile-8 513030 2307 ns/op

BenchmarkRegexpEval1-8 2795020 425.5 ns/op

BenchmarkRegexpEval2-8 3218155 370.2 ns/op

...

Edit: formatting