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

Faster #charpos #617

Merged
merged 4 commits into from
Mar 4, 2021
Merged

Faster #charpos #617

merged 4 commits into from
Mar 4, 2021

Conversation

soutaro
Copy link
Member

@soutaro soutaro commented Mar 4, 2021

StringScanner#charpos is really slow because it makes a new string object of its prefix and counts characters on the substring. The CharScanner is a quick hack to make #charpos calls faster.

  • It has @charpos to store current #charpos and updates on every move of the scan-pointer.
  • RBS only uses StringScanner#scan, so only updating in the method is good.

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.

1 participant