math/big: reduce allocations in writeMultiple() #71465
Labels
Implementation
Issues describing a semantics-preserving change to the Go implementation.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go version go1.23.5 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I'm trying to write a
big.Int
to aio.Writer
.I'm using
fmt.FPrintf
, and it callsbig.Int.Format()
.What did you see happen?
I did a benchmark, and noticed that many allocations are done in
writeMultiple()
:=> The
string
to[]byte
conversion.What did you expect to see?
I think we can replace
with
and remove
because
fmt.State
implementations implementsWriteString
.The text was updated successfully, but these errors were encountered: