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 tr instead of gsub when possible #17125

Merged
merged 1 commit into from
Oct 1, 2014
Merged

use tr instead of gsub when possible #17125

merged 1 commit into from
Oct 1, 2014

Conversation

acrogenesis
Copy link
Contributor

tr is over 5x faster than gsub, in this 2 cases they are interchangeable

@matthewd
Copy link
Member

matthewd commented Oct 1, 2014

Thanks, but I'm closing this as cosmetic: both of those occur adjacent to much more expensive operations, that will make any speed difference here insignificant.

@matthewd matthewd closed this Oct 1, 2014
@fxn fxn reopened this Oct 1, 2014
@fxn
Copy link
Member

fxn commented Oct 1, 2014

Hey, reopening this one. tr is the concise idiomatic method call you do for that kind of things. Applying because in my mind this is better code, regardless of performance.

fxn added a commit that referenced this pull request Oct 1, 2014
use tr instead of gsub when possible
@fxn fxn merged commit 6aa4482 into rails:master Oct 1, 2014
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.

3 participants