File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ package null
2
+
3
+ import (
4
+ "testing"
5
+ )
6
+
7
+ func BenchmarkIntUnmarshalJSON (b * testing.B ) {
8
+ input := []byte ("123456" )
9
+ var nullable Int
10
+ for n := 0 ; n < b .N ; n ++ {
11
+ nullable .UnmarshalJSON (input )
12
+ }
13
+ }
14
+
15
+ func BenchmarkIntStringUnmarshalJSON (b * testing.B ) {
16
+ input := []byte (`"123456"` )
17
+ var nullable String
18
+ for n := 0 ; n < b .N ; n ++ {
19
+ nullable .UnmarshalJSON (input )
20
+ }
21
+ }
22
+
23
+ func BenchmarkNullIntUnmarshalJSON (b * testing.B ) {
24
+ input := []byte ("null" )
25
+ var nullable Int
26
+ for n := 0 ; n < b .N ; n ++ {
27
+ nullable .UnmarshalJSON (input )
28
+ }
29
+ }
30
+
31
+ func BenchmarkStringUnmarshalJSON (b * testing.B ) {
32
+ input := []byte (`"hello"` )
33
+ var nullable String
34
+ for n := 0 ; n < b .N ; n ++ {
35
+ nullable .UnmarshalJSON (input )
36
+ }
37
+ }
38
+
39
+ func BenchmarkNullStringUnmarshalJSON (b * testing.B ) {
40
+ input := []byte ("null" )
41
+ var nullable String
42
+ for n := 0 ; n < b .N ; n ++ {
43
+ nullable .UnmarshalJSON (input )
44
+ }
45
+ }
You can’t perform that action at this time.
0 commit comments