Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/higebu/go-hello-bench
https://github.com/higebu/go-hello-bench
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/higebu/go-hello-bench
- Owner: higebu
- Created: 2016-04-25T11:24:28.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-25T11:33:54.000Z (almost 9 years ago)
- Last Synced: 2024-10-04T19:44:25.940Z (4 months ago)
- Language: Go
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-hello-bench
This is an repository of golang benchmark example.
* c1: the BenchmarkHello function called count
* c2: the Hello function called countResult:
```sh
$ go test -bench .
2016/04/25 20:18:24 NumCPU: 4
testing: warning: no tests to run
PASS
BenchmarkHello-4 2016/04/25 20:18:24 c1: 0
2016/04/25 20:18:24 c2: 1
2016/04/25 20:18:24 c1: 1
2016/04/25 20:18:24 c2: 101
2016/04/25 20:18:24 c1: 2
2016/04/25 20:18:24 c2: 10101
2016/04/25 20:18:24 c1: 3
2016/04/25 20:18:25 c2: 1010101
2016/04/25 20:18:25 c1: 4
2016/04/25 20:18:27 c2: 6010101
5000000 481 ns/op
ok github.com/higebu/go-hello-bench 2.778s
```Q. Why Hello function called too many times...
A. See launch() function in [testing/benchmark.go](https://golang.org/src/testing/benchmark.go?#L200)