]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: avoid reading entire PGO profile just to check the header
authorMichael Pratt <mpratt@google.com>
Wed, 31 Jan 2024 22:56:47 +0000 (17:56 -0500)
committerGopher Robot <gobot@golang.org>
Fri, 2 Feb 2024 22:08:32 +0000 (22:08 +0000)
commit9819d8265f92e0797df646f9a7056bb979d0005b
tree6d30721318b3d9aa204d2c6ba3cea59ba97ee99d
parent3d20a327a1f91ae912865aa13bc07cda9930fefc
cmd/compile: avoid reading entire PGO profile just to check the header

isPreProfileFile reads the entire file into memory just to check the
first few bytes, and then throws it all away. We can avoid this by just
peeking at the beginning.

For #58102.

Change-Id: Id2c2844e5e44a2f3a9c7cdb9a027d94d26bdf71d
Reviewed-on: https://go-review.googlesource.com/c/go/+/560035
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
src/cmd/compile/internal/pgo/irgraph.go