Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix EachKey pIdxFlags allocation #241

Merged
merged 1 commit into from
Apr 18, 2022
Merged

fix EachKey pIdxFlags allocation #241

merged 1 commit into from
Apr 18, 2022

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