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 faster alternative for str substitution #310

Merged
merged 3 commits into from Aug 31, 2019

Conversation

ashmaroli
Copy link
Contributor

#tr(str, rep_str) is faster than #gsub(str, rep_str) which in turn is faster than #gsub(pattern, rep_str)

In short, prefer alternatives that do not involve regular expressions

lib/addressable/uri.rb Outdated Show resolved Hide resolved
Copy link
Owner

@sporkmonger sporkmonger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sporkmonger sporkmonger merged commit 8808612 into sporkmonger:master Aug 31, 2019
@ashmaroli ashmaroli deleted the replace-regex-string branch August 31, 2019 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants