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

Array and guess #214

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

stephane-moreau
Copy link

Description:

  • Adding a simple public API allowing to guess what would be the result if we parse the data provided
  • Adding a way to stop array processing (like the one existing for objects) so that we fail early if required

Benchmark before change:
BenchmarkJsonParserLarge
BenchmarkJsonParserLarge-2 91435 57791 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserMedium
BenchmarkJsonParserMedium-2 638395 9380 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserDeleteMedium
BenchmarkJsonParserDeleteMedium-2 578287 10228 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserEachKeyManualMedium
BenchmarkJsonParserEachKeyManualMedium-2 928076 6298 ns/op 112 B/op 2 allocs/op
BenchmarkJsonParserEachKeyStructMedium
BenchmarkJsonParserEachKeyStructMedium-2 830934 7886 ns/op 560 B/op 12 allocs/op
BenchmarkJsonParserObjectEachStructMedium
BenchmarkJsonParserObjectEachStructMedium-2 572341 9921 ns/op 512 B/op 11 allocs/op
BenchmarkJsonParserSmall
BenchmarkJsonParserSmall-2 6185480 915 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserEachKeyManualSmall
BenchmarkJsonParserEachKeyManualSmall-2 8068620 746 ns/op 80 B/op 2 allocs/op
BenchmarkJsonParserEachKeyStructSmall
BenchmarkJsonParserEachKeyStructSmall-2 5681413 1073 ns/op 184 B/op 7 allocs/op
BenchmarkJsonParserObjectEachStructSmall
BenchmarkJsonParserObjectEachStructSmall-2 6723812 891 ns/op 168 B/op 6 allocs/op
BenchmarkJsonParserSetSmall
BenchmarkJsonParserSetSmall-2 4120005 1439 ns/op 768 B/op 4 allocs/op
BenchmarkJsonParserDelSmall
BenchmarkJsonParserDelSmall-2 3427260 1767 ns/op 0 B/op 0 allocs/op

Benchmark after change:
BenchmarkJsonParserLarge
BenchmarkJsonParserLarge-2 99598 57717 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserMedium
BenchmarkJsonParserMedium-2 553732 9533 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserDeleteMedium
BenchmarkJsonParserDeleteMedium-2 576543 10439 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserEachKeyManualMedium
BenchmarkJsonParserEachKeyManualMedium-2 944497 6367 ns/op 112 B/op 2 allocs/op
BenchmarkJsonParserEachKeyStructMedium
BenchmarkJsonParserEachKeyStructMedium-2 803428 7304 ns/op 560 B/op 12 allocs/op
BenchmarkJsonParserObjectEachStructMedium
BenchmarkJsonParserObjectEachStructMedium-2 566092 10477 ns/op 512 B/op 11 allocs/op
BenchmarkJsonParserSmall
BenchmarkJsonParserSmall-2 6631508 908 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserEachKeyManualSmall
BenchmarkJsonParserEachKeyManualSmall-2 8210907 753 ns/op 80 B/op 2 allocs/op
BenchmarkJsonParserEachKeyStructSmall
BenchmarkJsonParserEachKeyStructSmall-2 5331390 1098 ns/op 184 B/op 7 allocs/op
BenchmarkJsonParserObjectEachStructSmall
BenchmarkJsonParserObjectEachStructSmall-2 6622808 900 ns/op 168 B/op 6 allocs/op
BenchmarkJsonParserSetSmall
BenchmarkJsonParserSetSmall-2 3944966 1473 ns/op 768 B/op 4 allocs/op
BenchmarkJsonParserDelSmall
BenchmarkJsonParserDelSmall-2 3349132 1796 ns/op 0 B/op 0 allocs/op

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.

None yet

2 participants