github.com/go-email-validator/go-email-validator@v0.0.0-20230409163946-b8b9e6a0552e/test/performance/pointer_vs_value_set_test.go (about) 1 package performance 2 3 import "testing" 4 5 var value = 10 6 var valueForPtr = value 7 var ptr = &valueForPtr 8 9 func BenchmarkPointerSet(b *testing.B) { 10 for iteration := 0; iteration < b.N; iteration++ { 11 *ptr++ 12 _ = *ptr 13 } 14 } 15 16 func BenchmarkValueSet(b *testing.B) { 17 for iteration := 0; iteration < b.N; iteration++ { 18 value++ 19 _ = value 20 } 21 }