1
0
mirror of https://github.com/fluencelabs/tendermint synced 2025-06-29 12:41:44 +00:00
Files
.circleci
.github
DOCKER
benchmarks
blockchain
proto
simu
atomic_test.go
chan_test.go
codec_test.go
empty.go
map_test.go
os_test.go
blockchain
cmd
config
consensus
docs
evidence
lite
mempool
networks
node
p2p
proxy
rpc
scripts
state
test
types
version
.editorconfig
.gitignore
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Gopkg.lock
Gopkg.toml
LICENSE
Makefile
README.md
ROADMAP.md
Vagrantfile
appveyor.yml
codecov.yml
docker-compose.yml
tendermint/benchmarks/atomic_test.go

30 lines
556 B
Go
Raw Normal View History

2015-12-31 00:34:44 -08:00
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)))
}
}