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

Do not truncate strings inefficiently #9832

Closed
wants to merge 4 commits into from
Closed

Conversation

s7nfo
Copy link

@s7nfo s7nfo commented Feb 5, 2024

Hey folks,
as I demonstrated in this blog post, truncating string with s[0, x] = '' seems to lead to unnecessary memory copying. I've identified couple places in Ruby where this pattern is being used and this PR replaces it with the more efficient pattern.

If this look like something you might be interested in merging let me know if I need to do anything else here, it's my first PR against Ruby.

Related PR against this same issue in openssl: ruby/openssl#706

@s7nfo s7nfo marked this pull request as ready for review February 5, 2024 08:56
@s7nfo s7nfo changed the title Do not truncate buffer inefficiently in gci/core.rb Do not truncate strings inefficiently Feb 5, 2024
@s7nfo
Copy link
Author

s7nfo commented Feb 5, 2024

I just read ruby/openssl#706 (comment), I think this PR might be moot!

@s7nfo s7nfo closed this Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant