jsonparser icon indicating copy to clipboard operation
jsonparser copied to clipboard

Array and guess

Open stephane-moreau opened this issue 4 years ago • 0 comments

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

stephane-moreau avatar Oct 12 '20 15:10 stephane-moreau