]> Cypherpunks.ru repositories - gostls13.git/commit
internal/profile: use internal/lazyregexp for the legacy parser
authorDaniel Martí <mvdan@mvdan.cc>
Sun, 8 Jan 2023 23:07:43 +0000 (23:07 +0000)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 20 Jan 2023 09:27:47 +0000 (09:27 +0000)
commitf53137f95cfb1f33e592e2818fcb5e8d7ac80b66
tree397e90d3eeddfb632edc7f33f4c62956c0e5b9f9
parent1bef0707a537d19bbbfda09dde05e5874a2fb199
internal/profile: use internal/lazyregexp for the legacy parser

Per benchinit, this makes a big difference to init times:

name             old time/op    new time/op    delta
InternalProfile     185µs ± 1%       6µs ± 1%  -96.51%  (p=0.008 n=5+5)

name             old alloc/op   new alloc/op   delta
InternalProfile     101kB ± 0%       4kB ± 0%  -95.72%  (p=0.008 n=5+5)

name             old allocs/op  new allocs/op  delta
InternalProfile       758 ± 0%        25 ± 0%  -96.70%  (p=0.008 n=5+5)

The fixed 0.2ms init cost is saved for any importer of net/http/pprof,
but also for cmd/compile, as it supports PGO now.
A Go program parsing profiles might not even need to compile these
regular expressions at all, if it doesn't encounter any legacy files.
I suspect this will be the case with most invocations of cmd/compile.

Updates #26775.

Change-Id: I8374dc64459f0b6bb09bbdf9d0b6c55d7ae1646e
Reviewed-on: https://go-review.googlesource.com/c/go/+/460545
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/go/build/deps_test.go
src/internal/profile/legacy_profile.go
src/internal/profile/profile.go