]> Cypherpunks repositories - gostls13.git/commit
go/internal/gcimporter: use saferio.ReadData instead of io.ReadAll when possible
authorLasse Folger <lassefolger@google.com>
Mon, 3 Apr 2023 11:52:56 +0000 (13:52 +0200)
committerGopher Robot <gobot@golang.org>
Tue, 4 Apr 2023 22:46:26 +0000 (22:46 +0000)
commit19409663a09ffc65a7ff193a23a75763a4b5befd
tree9f3a6d724fdbe4a01538ac62fd2091d57d3d1ea6
parent2afaa018550ceb42e7a89d1bb53e7fe2d3890377
go/internal/gcimporter: use saferio.ReadData instead of io.ReadAll when possible

saferio.ReadData avoids unnecessary allocations because the buffer can be
preallocated with the right size (up to a limit) instead of having to resize
and copy it step by step.

Change-Id: Id70f6908971d4f126c601a9571ac3c67ea0accdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/481616
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/go/internal/gcimporter/gcimporter.go