diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-09-27 11:00:58 +0400 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-09-27 11:00:58 +0400 |
commit | c363fff29f060e6a2effe1e4bb2c4dd4cd805d6e (patch) | |
tree | b5823e39d7d4efd9a2144247c787810b32d12c6a /load_paths.rb | |
parent | 512122d9845f84e1a813fbd04ae80dee8ccdeb9e (diff) | |
download | rails-c363fff29f060e6a2effe1e4bb2c4dd4cd805d6e.tar.gz rails-c363fff29f060e6a2effe1e4bb2c4dd4cd805d6e.tar.bz2 rails-c363fff29f060e6a2effe1e4bb2c4dd4cd805d6e.zip |
some object allocation reduction for new AR objects
Benchmark:
```ruby
require 'objspace'
require 'active_record'
ActiveRecord::Base.establish_connection adapter: "sqlite3",
database: ":memory:"
ActiveRecord::Base.connection.instance_eval do
create_table(:articles) { |t| t.string :name }
end
class Article < ActiveRecord::Base; end
a = Article.create name: "foo"
a = Article.find a.id
N = 10
ObjectSpace::AllocationTracer.trace do
N.times { Article.find a.id }
end
ObjectSpace::AllocationTracer.allocated_count_table
table.sort_by { |_,x| x }.each do |k,v|
p k => (v / N)
end
```
Diffstat (limited to 'load_paths.rb')
0 files changed, 0 insertions, 0 deletions