/
githubmirror
/
GoFrame
Обзор
Документация
Войти
/
githubmirror
/
GoFrame
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
container/gmap/gmap_z_bench_syncmap_test.go
80 строк
1 KB
houseme
add golangci feature to guarantee codes quality (#2229)
01 ноя 2022, 15:12
Не верифицирован
01 ноя 2022, 15:12
1793bf0
Код
Авторство
О чём код?
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. // // This Source Code Form is subject to the terms of the MIT License. // If a copy of the MIT was not distributed with gm file, // You can obtain one at https://github.com/gogf/gf. // go test *.go -bench=".*" -benchmem package gmap_test import ( "sync" "testing" "github.com/gogf/gf/v2/container/gmap" ) var gm = gmap.NewIntIntMap(true) var sm = sync.Map{} func Benchmark_GMapSet(b *testing.B) { b.RunParallel(func(pb *testing.PB) { i := 0 for pb.Next() { gm.Set(i, i) i++ } }) } func Benchmark_SyncMapSet(b *testing.B) { b.RunParallel(func(pb *testing.PB) { i := 0 for pb.Next() { sm.Store(i, i) i++ } }) } func Benchmark_GMapGet(b *testing.B) { b.RunParallel(func(pb *testing.PB) { i := 0 for pb.Next() { gm.Get(i) i++ } }) } func Benchmark_SyncMapGet(b *testing.B) { b.RunParallel(func(pb *testing.PB) { i := 0 for pb.Next() { sm.Load(i) i++ } }) } func Benchmark_GMapRemove(b *testing.B) { b.RunParallel(func(pb *testing.PB) { i := 0 for pb.Next() { gm.Remove(i) i++ } }) } func Benchmark_SyncMapRmove(b *testing.B) { b.RunParallel(func(pb *testing.PB) { i := 0 for pb.Next() { sm.Delete(i) i++ } }) }