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

Use Box<Path> in lieu of PathBuf for immutable structs #12346

Merged
merged 1 commit into from
Mar 25, 2025

Conversation

charliermarsh
Copy link
Member

Summary

I don't know if I actually want to commit this, but I did it on the plane last time and just polished it off (got it to compile) while waiting to board.

@zanieb
Copy link
Member

zanieb commented Mar 20, 2025

I read the title and thought "classic Charlie on the plane PR"

@charliermarsh charliermarsh added the performance Potential performance improvement label Mar 22, 2025
@charliermarsh charliermarsh marked this pull request as ready for review March 24, 2025 14:37
@BurntSushi
Copy link
Member

It looks like there's no measurable change in perf, but I still feel like this is something we should do for "good sense" reasons. This also eliminates the possibility of any PathBuf being replaced here containing "extra" capacity (which would be a kind of space leak I guess). But I don't think any of our metrics really track that, so it's hard to know whether there is an actual improvement or not.

One interesting thing to consider would be a "small path" optimization. I'm not sure a crate for that exists. (A quick search didn't turn anything up.) It might be a little trickier to build than a small string optimization.

@charliermarsh charliermarsh enabled auto-merge (squash) March 25, 2025 21:48
@charliermarsh charliermarsh merged commit e4c98e9 into main Mar 25, 2025
76 checks passed
@charliermarsh charliermarsh deleted the charlie/path branch March 25, 2025 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Potential performance improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants