Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Go performance from version 1.2 to 1.18. Parent comment
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
There are no comments on this comment yet.
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