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: Using Generics for calculating Min and Max for numeric type #604 #609

Merged
merged 6 commits into from
Jul 29, 2023

Conversation

sadaghiani
Copy link
Contributor

Description

Duplicate codes are reduced and the performance is as follows.

cpu: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
BenchmarkMaxGeneric-4           1000000000               0.3357 ns/op          0 B/op          0 allocs/op
BenchmarkMax-4                  1000000000               0.3450 ns/op          0 B/op          0 allocs/op
PASS

Related issue(s)

@sadaghiani sadaghiani requested a review from b00f July 29, 2023 06:09
@codecov
Copy link

codecov bot commented Jul 29, 2023

Codecov Report

Merging #609 (39b8b0d) into main (6c36120) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #609      +/-   ##
==========================================
- Coverage   83.46%   83.45%   -0.01%     
==========================================
  Files         154      154              
  Lines        7292     7278      -14     
==========================================
- Hits         6086     6074      -12     
+ Misses        922      921       -1     
+ Partials      284      283       -1     

@kehiy kehiy enabled auto-merge (squash) July 29, 2023 06:34
@themantre
Copy link
Contributor

Interesting @sadaghiani
I am impressed by the benchmark result.
I can see the generic types have slightly better performance. 0.3357 compare to 0.3450 (+0.0093).

@kehiy kehiy merged commit 239bb98 into pactus-project:main Jul 29, 2023
12 checks passed
@sadaghiani sadaghiani removed the request for review from b00f July 29, 2023 11:17
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.

Using Generics for calculating Min and Max for numeric type
3 participants