Skip to content

[cxx-interop] Faster std::string initialization from String #72268

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

Merged
merged 1 commit into from
May 2, 2024

Conversation

egorzhdan
Copy link
Contributor

@egorzhdan egorzhdan commented Mar 12, 2024

Instead of appending characters one-by-one, which resizes the resulting string multiple times, let's reserve the required number of bytes beforehand.

rdar://127423949

@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Mar 12, 2024
@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@egorzhdan
Copy link
Contributor Author

@swift-ci please benchmark

Instead of appending characters one-by-one, which resizes the resulting string multiple times, let's reserve the required number of bytes beforehand.

rdar://127423949
@egorzhdan egorzhdan force-pushed the egorzhdan/std-string-reserve branch from 07d255b to 4513ca2 Compare May 2, 2024 13:07
@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@egorzhdan
Copy link
Contributor Author

@swift-ci please benchmark

@egorzhdan egorzhdan marked this pull request as ready for review May 2, 2024 13:08
@egorzhdan egorzhdan requested review from zoecarver and hyp as code owners May 2, 2024 13:08
@egorzhdan egorzhdan requested a review from stephentyrone May 2, 2024 15:39
@egorzhdan egorzhdan merged commit a5fdf15 into main May 2, 2024
@egorzhdan egorzhdan deleted the egorzhdan/std-string-reserve branch May 2, 2024 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants