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 cli.New to reduce memory allocation overhead #113

Merged
merged 3 commits into from
Nov 5, 2024

Conversation

FollowTheProcess
Copy link
Owner

@FollowTheProcess FollowTheProcess commented Nov 5, 2024

Summary

Tweaks cli.New to reduce the number of memory allocations it does, some low hanging fruit here it seems...

goos: darwin
goarch: amd64
pkg: github.com/FollowTheProcess/cli
cpu: Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
      │ before.txt  │             after.txt              │
      │   sec/op    │   sec/op     vs base               │
New-8   2.823µ ± 1%   2.600µ ± 1%  -7.90% (p=0.000 n=10)

      │  before.txt  │              after.txt               │
      │     B/op     │     B/op      vs base                │
New-8   2.720Ki ± 0%   2.250Ki ± 0%  -17.27% (p=0.000 n=10)

      │ before.txt │             after.txt              │
      │ allocs/op  │ allocs/op   vs base                │
New-8   38.00 ± 0%   34.00 ± 0%  -10.53% (p=0.000 n=10)

@FollowTheProcess FollowTheProcess added the performance Performance label Nov 5, 2024
Copy link

codecov bot commented Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.62%. Comparing base (82da24d) to head (fe9a82f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #113      +/-   ##
==========================================
- Coverage   91.65%   91.62%   -0.04%     
==========================================
  Files           7        7              
  Lines        1306     1301       -5     
==========================================
- Hits         1197     1192       -5     
  Misses         77       77              
  Partials       32       32              

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

@FollowTheProcess FollowTheProcess merged commit 5d4925b into main Nov 5, 2024
6 checks passed
@FollowTheProcess FollowTheProcess deleted the refactor/errors-join branch November 5, 2024 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant