From df56025aab01517c13370664bb0d36ca6ab9d6f0 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 16 Jan 2018 15:01:36 +0800 Subject: [PATCH] =?UTF-8?q?groutine=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- g/os/groutine/groutine_test.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/g/os/groutine/groutine_test.go b/g/os/groutine/groutine_test.go index f05d2d826..b89cf1835 100644 --- a/g/os/groutine/groutine_test.go +++ b/g/os/groutine/groutine_test.go @@ -13,21 +13,18 @@ import ( "gitee.com/johng/gf/g/os/groutine" ) -func test() { - num := 0 - for i := 0; i < 1000000; i++ { - num += i - } +func increment() { + for i := 0; i < 1000000; i++ {} } func BenchmarkGroutine(b *testing.B) { for i := 0; i < b.N; i++ { - groutine.Add(test) + groutine.Add(increment) } } func BenchmarkGoRoutine(b *testing.B) { for i := 0; i < b.N; i++ { - go test() + go increment() } } \ No newline at end of file