https://github.com/ipfans/gobenchtest
Some benchmarks for how to write more powerful golang code.
https://github.com/ipfans/gobenchtest
Last synced: over 1 year ago
JSON representation
Some benchmarks for how to write more powerful golang code.
- Host: GitHub
- URL: https://github.com/ipfans/gobenchtest
- Owner: ipfans
- License: mit
- Created: 2016-10-20T07:57:16.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-20T08:30:49.000Z (almost 10 years ago)
- Last Synced: 2025-01-31T10:11:27.739Z (over 1 year ago)
- Language: Go
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 字符串拼接测试
fmt.Sprintf等等会带来大量的性能损失,在热路径上尽量避免使用。
```
➜ test01 git:(master) ✗ go test -v -bench=. -benchmem
testing: warning: no tests to run
BenchmarkSimpleStringAppend-4 50000000 29.9 ns/op 0 B/op 0 allocs/op
BenchmarkSimpleStringFormat-4 5000000 271 ns/op 80 B/op 5 allocs/op
PASS
ok github.com/ipfans/gobenchtest/test01 3.191s
```