mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-22 09:21:32 +00:00
Revert "delete everything" (includes everything non-go-crypto)
This reverts commit 96a3502
This commit is contained in:
29
benchmarks/atomic_test.go
Normal file
29
benchmarks/atomic_test.go
Normal file
@ -0,0 +1,29 @@
|
||||
package benchmarks
|
||||
|
||||
import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func BenchmarkAtomicUintPtr(b *testing.B) {
|
||||
b.StopTimer()
|
||||
pointers := make([]uintptr, 1000)
|
||||
b.Log(unsafe.Sizeof(pointers[0]))
|
||||
b.StartTimer()
|
||||
|
||||
for j := 0; j < b.N; j++ {
|
||||
atomic.StoreUintptr(&pointers[j%1000], uintptr(j))
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAtomicPointer(b *testing.B) {
|
||||
b.StopTimer()
|
||||
pointers := make([]unsafe.Pointer, 1000)
|
||||
b.Log(unsafe.Sizeof(pointers[0]))
|
||||
b.StartTimer()
|
||||
|
||||
for j := 0; j < b.N; j++ {
|
||||
atomic.StorePointer(&pointers[j%1000], unsafe.Pointer(uintptr(j)))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user