Skip to content

fix EachKey pIdxFlags allocation#241

Merged
buger merged 1 commit intobuger:masterfrom
unxcepted:master
Apr 18, 2022
Merged

fix EachKey pIdxFlags allocation#241
buger merged 1 commit intobuger:masterfrom
unxcepted:master

Conversation

@unxcepted
Copy link
Contributor

Description: This pr implements patch from #223, which original author never made a PR for. Fixes one allocation in EachKey function caused by allocating pIdxFlags array.

Benchmark before change:

BenchmarkJsonParserEachKeyManualMedium
BenchmarkJsonParserEachKeyManualMedium-12         805526              6450 ns/op               8 B/op          2 allocs/op
BenchmarkJsonParserEachKeyStructMedium
BenchmarkJsonParserEachKeyStructMedium-12         644608              9243 ns/op             408 B/op         12 allocs/op

Benchmark after change:

BenchmarkJsonParserEachKeyManualMedium
BenchmarkJsonParserEachKeyManualMedium-12         947583              6521 ns/op               0 B/op          0 allocs/op
BenchmarkJsonParserEachKeyStructMedium
BenchmarkJsonParserEachKeyStructMedium-12         776686              8836 ns/op             400 B/op         10 allocs/op

@buger
Copy link
Owner

buger commented Apr 18, 2022

Sorry for delay, looks nice!

@buger buger merged commit 61b32cf into buger:master Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants