-
Notifications
You must be signed in to change notification settings - Fork 86
Optimize memory allocations #147
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
Hi @tgross35, sorry for pinging. This PR has been open for a while and was out of sync. I've resolved the conflicts and simplified the changes. Would you mind giving it a review when you have time? |
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.
Yeah, this repo isn't really actively maintained - and I don't know it any better than anybody else. But this is a small and straightforward change, so I think it can merge with a few small tweaks.
Bumping MSRV in #172 so that part passes |
Great, so let's use the new syntax then. |
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.
Thank you!
Post any benchmarks if you happen to have them (just curious if the effect is actually noticeable - the change is good either way)
Sure, I ran a simple benchmark with the following code: #[bench]
fn bench_long_pattern(b: &mut rust_test::Bencher) {
b.iter(|| {
glob("/*/some_very_very_long_path").unwrap().next();
})
} The result shows there is roughly an 8.8% speedup. In addition, the variance dropped significantly, indicating much more consistent performance (malloc does have unpredictable overhead I guess). before:
after:
|
Remove the redundant pattern joining, which can reduce memory allocations during the iteration.