encoding/json: optimizing memory allocation of json.RawMessage #58657
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, It does
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
This is the first time I open an issue in Golang repo and I don't know if it's under the right category. I would like to propose an optimization to json.RawMessage struct to get rid of an extract memory allocation on call of UnmarshalJSON func of json.RawMessage struct as stated below:
Current
Proposal
To verify the above optimization, I run below benchmark.
What did you expect to see?
BenchmarkRawMsg-16 1476358 797.3 ns/op 256 B/op 6 allocs/op
What did you see instead?
BenchmarkRawMsg-16 1467776 842.1 ns/op 288 B/op 7 allocs/op
The text was updated successfully, but these errors were encountered: