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

perf: common utils. 包括Md5, PK, PK2, UUID, SortedTags, DictedTagstring等函数 #393

Merged
merged 1 commit into from
Mar 7, 2018

Conversation

n4mine
Copy link
Member

@n4mine n4mine commented Mar 7, 2018

优化效果见如下benchmark结果

goos: darwin
goarch: amd64
pkg: github.com/n4mine/falcon-plus/common/utils
Benchmark_PK-4                            	 2000000	       632 ns/op	     112 B/op	       4 allocs/op
Benchmark_PK_orig-4                       	 2000000	       702 ns/op	     160 B/op	       7 allocs/op
Benchmark_PK2-4                           	10000000	       126 ns/op	      32 B/op	       1 allocs/op
Benchmark_PK2_orig-4                      	10000000	       204 ns/op	      64 B/op	       3 allocs/op
Benchmark_UUID-4                          	 2000000	       826 ns/op	     128 B/op	       4 allocs/op
Benchmark_UUID_orig-4                     	 2000000	       894 ns/op	     200 B/op	       9 allocs/op
Benchmark_Md5-4                           	 5000000	       294 ns/op	      64 B/op	       2 allocs/op
Benchmark_Md5_orig-4                      	 3000000	       582 ns/op	     192 B/op	       5 allocs/op
Benchmark_SortedTags_1pair-4              	10000000	       228 ns/op	       3 B/op	       1 allocs/op
Benchmark_SortedTags_1pair_orig-4         	 5000000	       309 ns/op	      35 B/op	       3 allocs/op
Benchmark_SortedTags_2pairs-4             	 3000000	       484 ns/op	      72 B/op	       3 allocs/op
Benchmark_SortedTags_2pairs_orig-4        	 2000000	       878 ns/op	     176 B/op	      10 allocs/op
Benchmark_SortedTags_3pairs-4             	 2000000	       618 ns/op	      96 B/op	       3 allocs/op
Benchmark_SortedTags_3pairs_orig-4        	 1000000	      1236 ns/op	     248 B/op	      13 allocs/op
Benchmark_SortedTags_4pairs-4             	 2000000	       770 ns/op	     112 B/op	       3 allocs/op
Benchmark_SortedTags_4pairs_orig-4        	 1000000	      1607 ns/op	     332 B/op	      17 allocs/op
Benchmark_SortedTags_5pairs-4             	 2000000	       924 ns/op	     144 B/op	       3 allocs/op
Benchmark_SortedTags_5pairs_orig-4        	 1000000	      1878 ns/op	     432 B/op	      20 allocs/op
Benchmark_SortedTags_6pairs-4             	 1000000	      1086 ns/op	     160 B/op	       3 allocs/op
Benchmark_SortedTags_6pairs_orig-4        	 1000000	      2319 ns/op	     499 B/op	      23 allocs/op
Benchmark_DictedTagstring_1pair-4         	 5000000	       259 ns/op	     352 B/op	       3 allocs/op
Benchmark_DictedTagstring_1pair_orig-4    	 5000000	       339 ns/op	     384 B/op	       4 allocs/op
Benchmark_DictedTagstring_2pairs-4        	 5000000	       450 ns/op	     368 B/op	       3 allocs/op
Benchmark_DictedTagstring_2pairs_orig-4   	 3000000	       561 ns/op	     432 B/op	       5 allocs/op
Benchmark_DictedTagstring_3pairs-4        	 3000000	       399 ns/op	     384 B/op	       3 allocs/op
Benchmark_DictedTagstring_3pairs_orig-4   	 2000000	       637 ns/op	     480 B/op	       6 allocs/op
Benchmark_DictedTagstring_4pairs-4        	 3000000	       485 ns/op	     400 B/op	       3 allocs/op
Benchmark_DictedTagstring_4pairs_orig-4   	 2000000	       813 ns/op	     528 B/op	       7 allocs/op
Benchmark_DictedTagstring_5pairs-4        	 3000000	       579 ns/op	     416 B/op	       3 allocs/op
Benchmark_DictedTagstring_5pairs_orig-4   	 1000000	      1026 ns/op	     576 B/op	       8 allocs/op
Benchmark_DictedTagstring_6pairs-4        	 2000000	       664 ns/op	     432 B/op	       3 allocs/op
Benchmark_DictedTagstring_6pairs_orig-4   	 1000000	      1151 ns/op	     624 B/op	       9 allocs/op
PASS
ok  	github.com/n4mine/falcon-plus/common/utils	64.320s

@laiwei laiwei merged commit ff9762f into open-falcon:master Mar 7, 2018
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