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

Tiny optimization of http auth Realm unquoting #19757

Merged
merged 1 commit into from
Apr 14, 2015

Conversation

Strech
Copy link

@Strech Strech commented Apr 14, 2015

Some tiny optimization for Realm unquoting

Benchmark.ips do |bm|
  bm.report('gsub') { '"My test Realm"'.gsub('"', '') }
  bm.report('tr') { '"My test Realm"'.tr('"', '') }
  bm.compare!
end
Calculating -------------------------------------
                gsub    25.497k i/100ms
                  tr    66.568k i/100ms
-------------------------------------------------
                gsub    384.830k (± 3.7%) i/s -      1.938M
                  tr      1.278M (± 2.7%) i/s -      6.391M

Comparison:
                  tr:  1278335.1 i/s
                gsub:   384830.3 i/s - 3.32x slower

@arthurnn
Copy link
Member

👍 thoughts @rafaelfranca ?

@rafaelfranca
Copy link
Member

@arthurnn LGTM :shipit:

arthurnn pushed a commit that referenced this pull request Apr 14, 2015
Tiny optimization of http auth Realm unquoting
@arthurnn arthurnn merged commit 7d4a1ab into rails:master Apr 14, 2015
@arthurnn
Copy link
Member

thanks @Strech

@Strech Strech deleted the http-auth-realm-unquoting branch April 15, 2015 06:31
@Strech
Copy link
Author

Strech commented Apr 15, 2015

@arthurnn Great 😂

@artofhuman
Copy link
Contributor

@Strech 👍 =)

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

4 participants