]> Cypherpunks repositories - gostls13.git/commit
go/types: use internal/lazyregexp for goVersionRx
authorDaniel Martí <mvdan@mvdan.cc>
Sun, 8 Jan 2023 22:56:40 +0000 (22:56 +0000)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 20 Jan 2023 09:35:03 +0000 (09:35 +0000)
commitc641d48afdf05de8aa15b4110cb07a2165c5f935
tree6fb00536d3b8b8fb7b7cdb7e389aecca6ad9fb7d
parent8259ac4986db5ce6dbdd9883b0bbd1402bfe7532
go/types: use internal/lazyregexp for goVersionRx

With benchinit, we see a noticeable improvement in init times:

name     old time/op    new time/op    delta
GoTypes    83.4µs ± 0%    43.7µs ± 1%  -47.57%  (p=0.029 n=4+4)

name     old alloc/op   new alloc/op   delta
GoTypes    26.5kB ± 0%    18.8kB ± 0%  -29.15%  (p=0.029 n=4+4)

name     old allocs/op  new allocs/op  delta
GoTypes       238 ± 0%       154 ± 0%  -35.29%  (p=0.029 n=4+4)

Port the same change to cmd/compile/internal/types and types2.

Updates #26775.

Change-Id: Ia1f7c4a4ce9a22d66e2aa9c9b9c341036993adca
Reviewed-on: https://go-review.googlesource.com/c/go/+/460544
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
src/cmd/compile/internal/types/goversion.go
src/cmd/compile/internal/types2/version.go
src/go/build/deps_test.go
src/go/types/version.go