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

Added bespoke error for null cases #228

Merged
merged 1 commit into from
Jun 20, 2021
Merged

Conversation

jonomacd
Copy link
Contributor

Description: This adds a bespoke null error to the typed Get functions

Benchmark before change:

BenchmarkJsonParserLarge
BenchmarkJsonParserLarge-4                    	  101186	     59316 ns/op	       0 B/op	       0 allocs/op
BenchmarkJsonParserMedium
BenchmarkJsonParserMedium-4                   	  664688	      9127 ns/op	       0 B/op	       0 allocs/op
BenchmarkJsonParserDeleteMedium
BenchmarkJsonParserDeleteMedium-4             	  584113	     16541 ns/op	       0 B/op	       0 allocs/op
BenchmarkJsonParserEachKeyManualMedium
BenchmarkJsonParserEachKeyManualMedium-4      	  697446	      7584 ns/op	     112 B/op	       2 allocs/op
BenchmarkJsonParserEachKeyStructMedium
BenchmarkJsonParserEachKeyStructMedium-4      	  718255	      9049 ns/op	     544 B/op	      12 allocs/op
BenchmarkJsonParserObjectEachStructMedium
BenchmarkJsonParserObjectEachStructMedium-4   	  598053	     14774 ns/op	     496 B/op	      11 allocs/op
BenchmarkJsonParserSmall
BenchmarkJsonParserSmall-4                    	 5438990	      1097 ns/op	       0 B/op	       0 allocs/op
BenchmarkJsonParserEachKeyManualSmall
BenchmarkJsonParserEachKeyManualSmall-4       	 8123079	       726.3 ns/op	      80 B/op	       2 allocs/op
BenchmarkJsonParserEachKeyStructSmall
BenchmarkJsonParserEachKeyStructSmall-4       	 5914904	      1101 ns/op	     184 B/op	       7 allocs/op
BenchmarkJsonParserObjectEachStructSmall
BenchmarkJsonParserObjectEachStructSmall-4    	 3735968	      1712 ns/op	     168 B/op	       6 allocs/op
BenchmarkJsonParserSetSmall
BenchmarkJsonParserSetSmall-4                 	 2382969	      3151 ns/op	     768 B/op	       4 allocs/op
BenchmarkJsonParserDelSmall
BenchmarkJsonParserDelSmall-4                 	 1917996	      4370 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	benchmarks	104.655s

Benchmark after change:

BenchmarkJsonParserLarge
BenchmarkJsonParserLarge-4                    	   98062	     63203 ns/op	       0 B/op	       0 allocs/op
BenchmarkJsonParserMedium
BenchmarkJsonParserMedium-4                   	  570456	      9970 ns/op	       0 B/op	       0 allocs/op
BenchmarkJsonParserDeleteMedium
BenchmarkJsonParserDeleteMedium-4             	  603286	     13375 ns/op	       0 B/op	       0 allocs/op
BenchmarkJsonParserEachKeyManualMedium
BenchmarkJsonParserEachKeyManualMedium-4      	  780256	      9199 ns/op	     112 B/op	       2 allocs/op
BenchmarkJsonParserEachKeyStructMedium
BenchmarkJsonParserEachKeyStructMedium-4      	  419198	     15755 ns/op	     544 B/op	      12 allocs/op
BenchmarkJsonParserObjectEachStructMedium
BenchmarkJsonParserObjectEachStructMedium-4   	  362432	     16357 ns/op	     496 B/op	      11 allocs/op
BenchmarkJsonParserSmall
BenchmarkJsonParserSmall-4                    	 3645873	      1711 ns/op	       0 B/op	       0 allocs/op
BenchmarkJsonParserEachKeyManualSmall
BenchmarkJsonParserEachKeyManualSmall-4       	 5796182	      1012 ns/op	      80 B/op	       2 allocs/op
BenchmarkJsonParserEachKeyStructSmall
BenchmarkJsonParserEachKeyStructSmall-4       	 5057808	      1171 ns/op	     184 B/op	       7 allocs/op
BenchmarkJsonParserObjectEachStructSmall
BenchmarkJsonParserObjectEachStructSmall-4    	 5825636	      1145 ns/op	     168 B/op	       6 allocs/op
BenchmarkJsonParserSetSmall
BenchmarkJsonParserSetSmall-4                 	 3933043	      2098 ns/op	     768 B/op	       4 allocs/op
BenchmarkJsonParserDelSmall
BenchmarkJsonParserDelSmall-4                 	 2888763	      1989 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	benchmarks	93.459s

@buger buger merged commit dc92d69 into buger:master Jun 20, 2021
@buger
Copy link
Owner

buger commented Jun 20, 2021

👌🏻

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