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
Cache absolute_path
to decrease allocations
#346
Conversation
While profiling local file handling, I noticed that resolving paths was taking a significant amount of time. It also caused quite a few allocations. By caching the path and using a constant value for the current directory, we can reduce the number of allocs by quite a lot. For example, when testing on the sentry documentation, we do 50,4% less allocations in total now. That's just a single test-case of course, but it's probably also helping in many other cases as well.
Another ~1.5% less allocs
I'm running into the same issues as in idanarye/rust-typed-builder#57 again.
My suspicion is that this is actually an issue in cargo-publish-all. When comparing the compile commands between cargo publish and cargo-publish-all, I see some differences: cargo publish --manifest-path lychee-lib/Cargo.toml --dry-run:
cargo-publish-all --dry-run --verbose:
Namely, cargo-publish-all uses @dblock fyi |
Did that just reappear and is it reproducible on main? |
Oh I might not have expressed myself very well. Just to be clear, the old bug with rust-typed-builder is fixed and that fix still works. But after adding the |
I see. You should (re)open an issue in cargo-publish-all, cc: @idanarye |
Good point. I've added a comment to https://gitlab.com/torkleyy/cargo-publish-all/-/issues/3. |
There was no update on the issue yet. I've decided to disable the |
* Cache `absolute_path` to decrease allocations While profiling local file handling, I noticed that resolving paths was taking a significant amount of time. It also caused quite a few allocations. By caching the path and using a constant value for the current directory, we can reduce the number of allocs by quite a lot. For example, when testing on the sentry documentation, we do 50,4% less allocations in total now. That's just a single test-case of course, but it's probably also helping in many other cases as well. * Defer to_string for attr.value to reduce allocs * Use Tendrils instead of Strings for parsing (another ~1.5% less allocs) * Move option parsing code into separate module * Handle base dir more correctly * Temporarily disable dry run
While profiling local file handling, I noticed that resolving paths was taking a
significant amount of time. It also caused quite a few allocations.
By caching the path and using a constant value for the current
directory, we can reduce the number of allocs by quite a lot (5%).
This is my second attempt at reducing allocs. The first one is here #345.