Watch Star Fork

John / gfGoMITGVP Join Project

Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
模块化、松耦合、轻量级、高性能的Go语言Web开发框架。支持热重启、热更新、多域名、多端口、多服务、HTTP/HTTPS、动态路由等特性,并提供了Web服务开发的系列核心组件,如:Router、Cookie、Session、服务注册、配置管理、模板引擎、数据校验、分页管理、数据库ORM等等等等,并且提供了数十个实用开发模块集,如:缓存、日志、时间、命令行、二进制、文件锁、对象池、连接池、数据编码、进程管理、进程通信、TCP/UDP组件、并发安全容器、Goroutine池等等等等等等。 http://gf.johng.cn/
Copy Edit Raw Blame History
grpool_testb2_test.go 695 Bytes John authored 2018-01-17 10:28 . 完善grpool测试脚本
// Copyright 2017 gf Author(https://gitee.com/johng/gf). 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://gitee.com/johng/gf.
// go test *.go -bench=".*" -count=1
package grpool_test
import (
"testing"
"gitee.com/johng/gf/g/os/grpool"
)
var n = 500000
func increment2() {
for i := 0; i < 1000000; i++ {}
}
func BenchmarkGrpool2(b *testing.B) {
b.N = n
for i := 0; i < b.N; i++ {
grpool.Add(increment)
}
}
func BenchmarkGoroutine2(b *testing.B) {
b.N = n
for i := 0; i < b.N; i++ {
go increment()
}
}

Comment ( 0 )

You need to Sign in for post a comment

Help Search