STL icon indicating copy to clipboard operation
STL copied to clipboard

`<filesystem>`: Preallocate memory in `path::operator/`

Open xenu opened this issue 2 years ago • 1 comments

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.

xenu avatar Oct 30 '23 04:10 xenu

@microsoft-github-policy-service agree

xenu avatar Oct 30 '23 04:10 xenu

Thank you! :heart_eyes_cat: Apologies for the (somewhat holiday-related) delay in getting this reviewed. I've pushed a conflict-free merge with main, followed by changes to address previous feedback, followed by changes for things I noticed, including test coverage. The logic looks solid (the only thing that needed a small patch was _Right being empty, and even that was probably technically well-defined due to basic_string null termination) - I really appreciate how you handled the strange corner cases.

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).

StephanTLavavej avatar Jan 25 '24 17:01 StephanTLavavej

Sorry for ignoring the review comments, I got busy with other stuff and then I forgot about this PR.

I've pushed a conflict-free merge with main, followed by changes to address previous feedback, followed by changes for things I noticed, including test coverage.

Thank you!

xenu avatar Jan 26 '24 12:01 xenu

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

StephanTLavavej avatar Jan 30 '24 08:01 StephanTLavavej

Thanks for optimizing this important function, and congratulations on your first microsoft/STL commit! :rocket: :heart_eyes_cat: :tada:

This is expected to ship in VS 2022 17.10 Preview 2.

StephanTLavavej avatar Jan 30 '24 20:01 StephanTLavavej