...
1
2
3 package ldvalue
4
5 import (
6 "testing"
7
8 "github.com/mailru/easyjson/jlexer"
9 "github.com/mailru/easyjson/jwriter"
10 )
11
12 func BenchmarkSerializeComplexValueEasyJSON(b *testing.B) {
13 value := makeComplexValue()
14 b.ResetTimer()
15 for i := 0; i < b.N; i++ {
16 writer := jwriter.Writer{}
17 value.MarshalEasyJSON(&writer)
18 }
19 }
20
21 func BenchmarkDeserializeComplexValueEasyJSON(b *testing.B) {
22 data, _ := makeComplexValue().MarshalJSON()
23 b.ResetTimer()
24 for i := 0; i < b.N; i++ {
25 lexer := jlexer.Lexer{Data: data}
26 benchmarkValueResult.UnmarshalEasyJSON(&lexer)
27 }
28 }
29
View as plain text