/
githubmirror
/
GoFrame
Обзор
Документация
Войти
/
githubmirror
/
GoFrame
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
container/gpool/gpool_bench_test.go
45 строк
803 B
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 this file, // You can obtain one at https://github.com/gogf/gf. // go test *.go -bench=".*" package gpool_test import ( "sync" "testing" "time" "github.com/gogf/gf/v2/container/gpool" ) var pool = gpool.New(time.Hour, nil) var syncp = sync.Pool{} func BenchmarkGPoolPut(b *testing.B) { for i := 0; i < b.N; i++ { pool.Put(i) } } func BenchmarkGPoolGet(b *testing.B) { for i := 0; i < b.N; i++ { pool.Get() } } func BenchmarkSyncPoolPut(b *testing.B) { for i := 0; i < b.N; i++ { syncp.Put(i) } } func BenchmarkSyncPoolGet(b *testing.B) { for i := 0; i < b.N; i++ { syncp.Get() } }