* lib/timeout.rb: freeze a string message - #996
Closed
JuanitoFatas wants to merge 1 commit into
Closed
Conversation
Why: Saves ~ 1M string allocations on every request From benchmarking one of my rails app, I found this line allocating many string objects. 1050056 /Users/Juan/.rubies/ruby-2.2.2/lib/ruby/2.2.0/timeout.rb:80 Before this patch 2828765 activerecord-4.2.3 2695930 ruby-2.2.2/lib 1057453 activesupport-4.2.3 After this patch allocated memory by gem ----------------------------------- 2828765 activerecord-4.2.3 1627551 ruby-2.2.2/lib 1057213 activesupport-4.2.3 I use derailed_benchmarks gem to benchmark my Rails app, the exact command is bundle exec derailed exec perf:objects
Member
Author
|
Thanks! 🙇 |
nurse
pushed a commit
to nurse/ruby
that referenced
this pull request
Sep 18, 2015
* lib/timeout.rb (Timeout#timeout): freeze a string message to reduce string allocations. [Fix rubyGH-996] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why: Saves ~ 1M string allocations on every request
From benchmarking one of my rails app, I found this line allocating
many string objects.
1050056 /Users/Juan/.rubies/ruby-2.2.2/lib/ruby/2.2.0/timeout.rb:80
Before this patch
After this patch
I use derailed_benchmarks gem to benchmark my Rails app, the exact command is