100-go-mistakes/11-testing/89-benchmark/wrong-assumptions/main_test.go
2021-12-27 15:56:17 +01:00

20 lines
293 B
Go

package main
import (
"sync/atomic"
"testing"
)
func BenchmarkAtomicStoreInt32(b *testing.B) {
var v int32
for i := 0; i < b.N; i++ {
atomic.StoreInt32(&v, 1)
}
}
func BenchmarkAtomicStoreInt64(b *testing.B) {
var v int64
for i := 0; i < b.N; i++ {
atomic.StoreInt64(&v, 1)
}
}