1
0
mirror of https://github.com/json-iterator/go.git synced 2025-07-09 23:45:32 +02:00

Unmarshalling float with lots of digits can cause >= 2 allocations per number

We can fix this with a little bit of scratch space.
This commit is contained in:
Phil Pearl
2022-02-14 11:09:22 +00:00
parent 024077e996
commit e79221c6f6
4 changed files with 74 additions and 11 deletions

View File

@ -26,8 +26,10 @@ const (
ObjectValue
)
var hexDigits []byte
var valueTypes []ValueType
var (
hexDigits []byte
valueTypes []ValueType
)
func init() {
hexDigits = make([]byte, 256)
@ -78,6 +80,7 @@ type Iterator struct {
captureStartedAt int
captured []byte
Error error
scratch []byte
Attachment interface{} // open for customized decoder
}