...
1 package ldvalue
2
3 import "testing"
4
5 func BenchmarkNewOptionalBoolNoAlloc(b *testing.B) {
6 for i := 0; i < b.N; i++ {
7 benchmarkOptBoolResult = NewOptionalBool(benchmarkBoolValue)
8 }
9 }
10
11 func BenchmarkNewOptionalBoolFromPointerNoAlloc(b *testing.B) {
12 for i := 0; i < b.N; i++ {
13 benchmarkOptBoolResult = NewOptionalBoolFromPointer(benchmarkBoolPointer)
14 }
15 }
16
17 func BenchmarkOptionalBoolValueNoAlloc(b *testing.B) {
18 for i := 0; i < b.N; i++ {
19 benchmarkBoolResult = benchmarkOptBoolWithValue.BoolValue()
20 }
21 }
22
23 func BenchmarkOptionalBoolGetNoAlloc(b *testing.B) {
24 for i := 0; i < b.N; i++ {
25 benchmarkBoolResult, _ = benchmarkOptBoolWithValue.Get()
26 }
27 }
28
29 func BenchmarkOptionalBoolAsValueNoAlloc(b *testing.B) {
30 for i := 0; i < b.N; i++ {
31 benchmarkValueResult = benchmarkOptBoolWithValue.AsValue()
32 }
33 }
34
View as plain text