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

<filesystem>: Preallocate memory in path::operator/ #4136

Merged
merged 14 commits into from
Jan 30, 2024

Conversation

xenu
Copy link
Contributor

@xenu xenu commented Oct 30, 2023

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.

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 xenu requested a review from a team as a code owner October 30, 2023 04:20
@xenu
Copy link
Contributor Author

xenu commented Oct 30, 2023

@microsoft-github-policy-service agree

stl/inc/filesystem Outdated Show resolved Hide resolved
stl/inc/filesystem Outdated Show resolved Hide resolved
stl/inc/filesystem Outdated Show resolved Hide resolved
@StephanTLavavej StephanTLavavej added performance Must go faster filesystem C++17 filesystem labels Oct 30, 2023
@StephanTLavavej StephanTLavavej self-assigned this Oct 31, 2023
stl/inc/filesystem Outdated Show resolved Hide resolved
stl/inc/filesystem Outdated Show resolved Hide resolved
stl/inc/filesystem Outdated Show resolved Hide resolved
stl/inc/filesystem Show resolved Hide resolved
stl/inc/filesystem Show resolved Hide resolved
@StephanTLavavej StephanTLavavej removed their assignment Nov 1, 2023
@StephanTLavavej StephanTLavavej self-assigned this Nov 15, 2023
stl/inc/filesystem Outdated Show resolved Hide resolved
stl/inc/filesystem Outdated Show resolved Hide resolved
stl/inc/filesystem Outdated Show resolved Hide resolved
stl/inc/filesystem Show resolved Hide resolved
@StephanTLavavej StephanTLavavej removed their assignment Jan 25, 2024
@StephanTLavavej
Copy link
Member

Thank you! 😻 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).

@xenu
Copy link
Contributor Author

xenu commented Jan 26, 2024

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!

@StephanTLavavej StephanTLavavej self-assigned this Jan 30, 2024
@StephanTLavavej
Copy link
Member

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

@StephanTLavavej StephanTLavavej merged commit 9c10c1a into microsoft:main Jan 30, 2024
35 checks passed
@StephanTLavavej
Copy link
Member

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.

@xenu xenu deleted the xenu/path-concat branch February 14, 2024 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filesystem C++17 filesystem performance Must go faster
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants