...
1 package ldvalue
2
3 import "testing"
4
5 func BenchmarkNullValueNoAlloc(b *testing.B) {
6 for i := 0; i < b.N; i++ {
7 benchmarkValueResult = Null()
8 }
9 }
10
11 func BenchmarkBoolValueNoAlloc(b *testing.B) {
12 for i := 0; i < b.N; i++ {
13 benchmarkValueResult = Bool(true)
14 benchmarkBoolResult = benchmarkValueResult.BoolValue()
15 }
16 }
17
18 func BenchmarkIntValueNoAlloc(b *testing.B) {
19 for i := 0; i < b.N; i++ {
20 benchmarkValueResult = Int(1)
21 benchmarkIntResult = benchmarkValueResult.IntValue()
22 }
23 }
24
25 func BenchmarkFloat64ValueNoAlloc(b *testing.B) {
26 for i := 0; i < b.N; i++ {
27 benchmarkValueResult = Float64(1)
28 benchmarkFloat64Result = benchmarkValueResult.Float64Value()
29 }
30 }
31
32 func BenchmarkStringValueNoAlloc(b *testing.B) {
33 for i := 0; i < b.N; i++ {
34 benchmarkValueResult = String(benchmarkStringValue)
35 benchmarkStringResult = benchmarkValueResult.StringValue()
36 }
37 }
38
View as plain text