diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-12 14:34:04 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-10-12 16:37:12 -0700 |
commit | 3a6dfca7f5f5bd45cea2f6ac348178e72423e1d5 (patch) | |
tree | 054424a2c6a67c76d7dc4d03b7e5b8f2d80d8221 /railties/lib | |
parent | e68b97a4b65787711e50aa1565b4dd0077a00d6d (diff) | |
download | rails-3a6dfca7f5f5bd45cea2f6ac348178e72423e1d5.tar.gz rails-3a6dfca7f5f5bd45cea2f6ac348178e72423e1d5.tar.bz2 rails-3a6dfca7f5f5bd45cea2f6ac348178e72423e1d5.zip |
Speed up relation merging by reducing calls to Array#-
before:
Calculating -------------------------------------
ar 83 i/100ms
-------------------------------------------------
ar 832.1 (±4.0%) i/s - 4233 in 5.096611s
after:
Calculating -------------------------------------
ar 87 i/100ms
-------------------------------------------------
ar 839.0 (±9.3%) i/s - 4176 in 5.032782s
Benchmark:
require 'config/environment'
require 'benchmark/ips'
GC.disable
unless User.find_by_login('tater')
u = User.new
u.login = 'tater'
u.save!
end
def active_record
user = User.find_by_login('tater')
starred = user.starred_items.count
end
active_record
Benchmark.ips do |x|
x.report("ar") { active_record }
end
Diffstat (limited to 'railties/lib')
0 files changed, 0 insertions, 0 deletions