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

Refactor: trade slightly higher execution time for less memory allocation #13

Closed
wants to merge 4 commits into from

Conversation

yunginnanet
Copy link
Owner

Original

goos: linux
goarch: amd64
pkg: github.com/yunginnanet/Rate5
cpu: 13th Gen Intel(R) Core(TM) i9-13900K
BenchmarkCheck
BenchmarkCheck-32                            	8302140	      143.9 ns/op	     40 B/op	      3 allocs/op
BenchmarkCheckHardcore
BenchmarkCheckHardcore-32                    	3354300	      355.3 ns/op	     63 B/op	      5 allocs/op
BenchmarkCheckStrict
BenchmarkCheckStrict-32                      	3332241	      355.4 ns/op	     63 B/op	      5 allocs/op
BenchmarkCheckStringer
BenchmarkCheckStringer-32                    	7158397	      177.2 ns/op	     56 B/op	      4 allocs/op
BenchmarkPeek
BenchmarkPeek-32                             	13619250	       88.06 ns/op	      0 B/op	      0 allocs/op
BenchmarkConcurrentCheck
BenchmarkConcurrentCheck-32                  	4704564	      249.1 ns/op	     40 B/op	      3 allocs/op
BenchmarkConcurrentSetAndCheckHardcore
BenchmarkConcurrentSetAndCheckHardcore-32    	2077162	      581.3 ns/op	     63 B/op	      5 allocs/op
BenchmarkConcurrentSetAndCheckStrict
BenchmarkConcurrentSetAndCheckStrict-32      	2059890	      567.1 ns/op	     63 B/op	      5 allocs/op
BenchmarkConcurrentPeek
BenchmarkConcurrentPeek-32                   	6792751	      182.3 ns/op	      0 B/op	      0 allocs/op
PASS

This PR

goos: linux
goarch: amd64
pkg: github.com/yunginnanet/Rate5
cpu: 13th Gen Intel(R) Core(TM) i9-13900K
BenchmarkCheck
BenchmarkCheck-32                            	4973056	      241.4 ns/op	     32 B/op	      2 allocs/op
BenchmarkCheckHardcore
BenchmarkCheckHardcore-32                    	2726428	      437.1 ns/op	     40 B/op	      2 allocs/op
BenchmarkCheckStrict
BenchmarkCheckStrict-32                      	2737549	      437.8 ns/op	     40 B/op	      2 allocs/op
BenchmarkCheckStringer
BenchmarkCheckStringer-32                    	4440523	      265.9 ns/op	     48 B/op	      3 allocs/op
BenchmarkPeek
BenchmarkPeek-32                             	13621988	       89.78 ns/op	      0 B/op	      0 allocs/op
BenchmarkConcurrentCheck
BenchmarkConcurrentCheck-32                  	2956100	      411.5 ns/op	     32 B/op	      2 allocs/op
BenchmarkConcurrentSetAndCheckHardcore
BenchmarkConcurrentSetAndCheckHardcore-32    	1656236	      697.8 ns/op	     40 B/op	      3 allocs/op
BenchmarkConcurrentSetAndCheckStrict
BenchmarkConcurrentSetAndCheckStrict-32      	1703101	      722.1 ns/op	     40 B/op	      3 allocs/op
BenchmarkConcurrentPeek
BenchmarkConcurrentPeek-32                   	6395762	      174.7 ns/op	      0 B/op	      0 allocs/op

Copy link

codecov bot commented Feb 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4a3e80a) 100.00% compared to head (d3c6f59) 100.00%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #13   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          249       255    +6     
=========================================
+ Hits           249       255    +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yunginnanet
Copy link
Owner Author

superseded by #14 which is free lunch comparatively

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.

1 participant