Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change: 优化, 使用"+"代替Sprintf #287

Merged
merged 1 commit into from
Nov 7, 2017
Merged

Conversation

n4mine
Copy link
Member

@n4mine n4mine commented Nov 7, 2017

Sprintf性能太差, RrdFileName、FormRrdCacheKey均为高频使用的函数。
附benchmark

=== RUN   Test_RrdFileName
--- PASS: Test_RrdFileName (0.00s)
=== RUN   Test_FormRrdCacheKey
--- PASS: Test_FormRrdCacheKey (0.00s)
goos: darwin
goarch: amd64
pkg: github.com/open-falcon/falcon-plus/modules/graph/g
Benchmark_RrdFileName-4            	10000000	       127 ns/op
Benchmark_RrdFileName_orig-4       	 3000000	       506 ns/op
Benchmark_FormRrdCacheKey-4        	20000000	        90.4 ns/op
Benchmark_FormRrdCacheKey_orig-4   	 5000000	       324 ns/op
PASS
ok  	github.com/open-falcon/falcon-plus/modules/graph/g	7.282s

@laiwei
Copy link
Member

laiwei commented Nov 7, 2017

nice job 👍

@laiwei laiwei merged commit 4d8e125 into open-falcon:master Nov 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants