From 38ac0e025d3718fbc54b732acfab58718cfee4a7 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Fri, 31 Jul 2020 18:07:40 +0900 Subject: [PATCH] Add benchmark for Decode of GoJay --- benchmarks/decode_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/benchmarks/decode_test.go b/benchmarks/decode_test.go index 47d01e0..edcac10 100644 --- a/benchmarks/decode_test.go +++ b/benchmarks/decode_test.go @@ -30,6 +30,18 @@ func Benchmark_Decode_SmallStruct_JsonIter(b *testing.B) { } } +func Benchmark_Decode_SmallStruct_GoJayDecode(b *testing.B) { + b.ReportAllocs() + reader := bytes.NewReader(SmallFixture) + for n := 0; n < b.N; n++ { + reader.Reset(SmallFixture) + result := SmallPayload{} + if err := gojay.NewDecoder(reader).DecodeObject(&result); err != nil { + b.Fatal(err) + } + } +} + func Benchmark_Decode_SmallStruct_GoJay(b *testing.B) { b.ReportAllocs() for n := 0; n < b.N; n++ {