...
1 package ldvalue
2
3 import "testing"
4
5 func BenchmarkNewOptionalIntNoAlloc(b *testing.B) {
6 for i := 0; i < b.N; i++ {
7 benchmarkOptIntResult = NewOptionalInt(benchmarkIntValue)
8 }
9 }
10
11 func BenchmarkNewOptionalIntFromPointerNoAlloc(b *testing.B) {
12 for i := 0; i < b.N; i++ {
13 benchmarkOptIntResult = NewOptionalIntFromPointer(benchmarkIntPointer)
14 }
15 }
16
17 func BenchmarkOptionalIntValueNoAlloc(b *testing.B) {
18 for i := 0; i < b.N; i++ {
19 benchmarkIntResult = benchmarkOptIntWithValue.IntValue()
20 }
21 }
22
23 func BenchmarkOptionalIntGetNoAlloc(b *testing.B) {
24 for i := 0; i < b.N; i++ {
25 benchmarkIntResult, benchmarkBoolResult = benchmarkOptIntWithValue.Get()
26 }
27 }
28
29 func BenchmarkOptionalIntAsValueNoAlloc(b *testing.B) {
30 for i := 0; i < b.N; i++ {
31 benchmarkValueResult = benchmarkOptIntWithValue.AsValue()
32 }
33 }
34
View as plain text