commit 38c8a23b2f609fe2ee642f28b4e7543090f8c421 parent aa59043b98859004e1f91522a48730eb0c0d3deb Author: francoispqt <francois@parquet.ninja> Date: Tue, 28 Aug 2018 23:55:26 +0800 remove benchmark for decode null Diffstat:
D | benchmarks/decoder/decoder_null_test.go | | | 61 | ------------------------------------------------------------- |
1 file changed, 0 insertions(+), 61 deletions(-)
diff --git a/benchmarks/decoder/decoder_null_test.go b/benchmarks/decoder/decoder_null_test.go @@ -1,61 +0,0 @@ -package benchmarks - -import ( - "encoding/json" - "testing" - - "github.com/francoispqt/gojay" -) - -type ObjNullReflect struct { - O *ObjNullReflect -} - -func (o *ObjNullReflect) UnmarshalJSONObject(dec *gojay.Decoder, k string) error { - switch k { - case "o": - return dec.ObjectNullReflect(&o.O) - } - return nil -} - -func (o *ObjNullReflect) NKeys() int { - return 0 -} - -type ObjNullFactory struct { - O *ObjNullFactory -} - -func (o *ObjNullFactory) UnmarshalJSONObject(dec *gojay.Decoder, k string) error { - switch k { - case "o": - return dec.ObjectNullFactory(func() gojay.UnmarshalerJSONObject { - o.O = &ObjNullFactory{} - return o.O - }) - } - return nil -} - -func (o *ObjNullFactory) NKeys() int { - return 0 -} - -var objNullJSON = []byte(`{"o":{}}`) - -func BenchmarkJSONDecodeObjNullReflection(b *testing.B) { - b.ReportAllocs() - for n := 0; n < b.N; n++ { - result := &ObjNullReflect{} - json.Unmarshal(objNullJSON, &result) - } -} - -func BenchmarkJSONDecodeObjNullFactory(b *testing.B) { - b.ReportAllocs() - for n := 0; n < b.N; n++ { - result := &ObjNullFactory{} - json.Unmarshal(objNullJSON, &result) - } -}