-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
echo: Reduce memory allocation #10090
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
Conversation
|
This is great work, I'd love to see if we had a way to track these changes over time. What was the main method you used for determining the memory usage, did you set up a benchmark? |
|
GNU testsuite comparison: |
2 similar comments
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
|
Hey @ChrisDryden , for benchmarking I used I believe the |
| .stdout_matches(&Regex::new(r"^echo \(uutils coreutils\) (\d+\.\d+\.\d+)\n$").unwrap()); | ||
| } | ||
|
|
||
| #[test] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems unrelated to this pr ?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR removes the length check from args in case of --help and --version and instead uses other logic to infer the length
These test cases serve as additional confirmation that the changes did not regress any behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improved the patchset. Please let me know if any further improvements are required.
| } | ||
|
|
||
| #[test] | ||
| fn multiple_help_argument() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, unrelated
|
GNU testsuite comparison: |
|
The CI failure logs seem to indicate its unrelated to the PR changes? It was working with the same code earlier... |

Replaced the vector allocation in
filter_flagswith direct iterator usage for reduced memory overhead.Added new tests to cover edge cases encountered during previous implementation attempts.
Memory Usage Analysis:
Using /usr/bin/time (Linux)
printf "00 %.0s" {1..100000} > args.txtResults:
main: Maximum resident set size (kbytes):19364This PR: Maximum resident set size (kbytes):
12280System
echo: Maximum resident set size (kbytes):2544Using dhat-rs:
main:This PR: