argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
18.05k stars 5.51k forks source link

chore: enable perfsprint linter #20685

Closed mmorel-35 closed 2 weeks ago

mmorel-35 commented 3 weeks ago

enables and fixes int-conversion and sprintf1 rules of perfsprint linter issues.

bunnyshell[bot] commented 3 weeks ago

:x: Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.

Project coverage is 55.24%. Comparing base (b78f209) to head (673decc). Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
util/lua/oslib_safe.go 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #20685 +/- ## ========================================== + Coverage 55.17% 55.24% +0.06% ========================================== Files 324 324 Lines 55259 55256 -3 ========================================== + Hits 30487 30524 +37 + Misses 22158 22118 -40 Partials 2614 2614 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

andrii-korotkov-verkada commented 3 weeks ago

Can you share more details about the gains perfsprint gives, please?

mmorel-35 commented 3 weeks ago

This suggest methods that are faster in their use and so don't use the extra memory that is necessary when using general function For example fmt.Sprintf instanciate a printer which is then freed https://cs.opensource.google/go/go/+/refs/tags/go1.23.3:src/fmt/print.go;l=237 while there is no need when using directly strconv.Itoa when you only need to convert an integer to string.