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

Use String#byteindex instead of String#index #286

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

shugo
Copy link
Member

@shugo shugo commented May 23, 2024

Because String#index takes O(N), where N is the second argument, while String#byteindex takes O(1).

Because String#index takes O(N), where N is the second argument, while String#byteindex takes O(1).
@shugo
Copy link
Member Author

shugo commented May 23, 2024

We should wait until Ruby 3.1 gets EOL.

@nevans nevans added this to the v0.6 milestone May 23, 2024
@nevans
Copy link
Collaborator

nevans commented May 23, 2024

@shugo I added it to a new v0.6 milestone. 🙂

@admsev
Copy link

admsev commented May 26, 2024

@gooroodev WDYT?

@gooroodev

This comment was marked as spam.

@nevans
Copy link
Collaborator

nevans commented May 27, 2024

@admsev @gooroodev please don't. It's obnoxious and not very helpful.

@shugo
Copy link
Member Author

shugo commented Aug 13, 2024

I remember now that the argument of ResponseParser#parse is usually ASCII-8BIT, so this change doesn't matter unless ResponseParser#parse is directly used with other encodings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants