Hi,
I can''t remember whether I promised more performance patches, but
anyways here
they are ;)
http://dev.rubyonrails.org/ticket/11108
By rewriting string callbacks to symbol callbacks in AR associations we can
get significant performance improvement because there''s no need to
create
extra Binding object for each string callback to be evaluated with eval().
The performance improvement is tangible even for individual model operations,
not saying anything about loops (I saved 50M memory and 700ms because of this
change).
http://dev.rubyonrails.org/ticket/11109
This change is quite controversial, but it also has effect. method_missing is
often called for AR associations to pass method calls to underlying array but
method missing has &block parameter and thus requires Ruby to create Proc
object and Binding along with it. This allocates noticeable amount of memory
and can be avoided replacing each call like
def foo(&block)
bar(&block)
end
with
def foo
bar { |*block_args| yield(*block_args) if block_given?
end
I''ve explained the problem and performance gains in more details in
ticket
descriptions and also in the blog:
http://blog.pluron.com/2008/02/rails-faster-as.html
http://dev.rubyonrails.org/ticket/11110
The idea of this small performance improvement is that most likely people will
not subclass from BigDecimal''s and Rails'' type_cast method
will always get
BigDecimal''s. Therefore we can save a couple of milliseconds when
checking if
the value is already BigDecimal using class equality instead of #is_a?
method.
http://dev.rubyonrails.org/ticket/11111
This is the simplest change. AR::Base#attributes_with_quotes likes to call
AR::Base#connection methods. By cashing the return value of the #connection
method we can save a couple of milliseconds.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---
On 2/13/08, Alexander Dymo <adymo@pluron.com> wrote:> Hi, > I can''t remember whether I promised more performance patches, but anyways here > they are ;)Great work, Alexander! It''s wonderful seeing our memory footprint shrink, bit by bit. Best, jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---