...
1 package ldvalue
2
3 import "testing"
4
5 func BenchmarkNewOptionalStringNoAlloc(b *testing.B) {
6 for i := 0; i < b.N; i++ {
7 benchmarkOptStringResult = NewOptionalString(benchmarkStringValue)
8 }
9 }
10
11 func BenchmarkNewOptionalStringFromPointerNoAlloc(b *testing.B) {
12 for i := 0; i < b.N; i++ {
13 benchmarkOptStringResult = NewOptionalStringFromPointer(benchmarkStringPointer)
14 }
15 }
16
17 func BenchmarkOptionalStringValueNoAlloc(b *testing.B) {
18 for i := 0; i < b.N; i++ {
19 benchmarkStringResult = benchmarkOptStringWithValue.StringValue()
20 }
21 }
22
23 func BenchmarkOptionalStringGetNoAlloc(b *testing.B) {
24 for i := 0; i < b.N; i++ {
25 benchmarkStringResult, benchmarkBoolResult = benchmarkOptStringWithValue.Get()
26 }
27 }
28
29 func BenchmarkOptionalStringAsValueNoAlloc(b *testing.B) {
30 for i := 0; i < b.N; i++ {
31 benchmarkValueResult = benchmarkOptStringWithValue.AsValue()
32 }
33 }
34
View as plain text