<filesystem>: Preallocate memory in path::operator/#4136
<filesystem>: Preallocate memory in path::operator/#4136StephanTLavavej merged 14 commits intomicrosoft:mainfrom
<filesystem>: Preallocate memory in path::operator/#4136Conversation
Now, in the typical case, it will do at most a single allocation. It's a hot path in my program, and a cursory GitHub search showed that path::operator/ is indeed commonly used.
|
@microsoft-github-policy-service agree |
Co-authored-by: Casey Carter <cacarter@microsoft.com>
We're talking about something in the future that we want to avoid doing, instead of something in the past that we avoided doing.
This doesn't exercise the optimization, it's just a good idea.
With this, I believe all codepaths are exercised.
|
Thank you! 😻 Apologies for the (somewhat holiday-related) delay in getting this reviewed. I've pushed a conflict-free merge with We have a semi-manual process for simultaneously merging PRs to the GitHub and MSVC-internal repos. To save time, we batch up PRs, so your PR will be part of the next batch (possibly tomorrow but more likely next week). |
|
Sorry for ignoring the review comments, I got busy with other stuff and then I forgot about this PR.
Thank you! |
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
|
Thanks for optimizing this important function, and congratulations on your first microsoft/STL commit! 🚀 😻 🎉 This is expected to ship in VS 2022 17.10 Preview 2. |
Now, in the typical case, it will do at most a single allocation.
It's a hot path in my program, and a cursory GitHub search showed that
path::operator/is indeed commonly used.