1. 19 2月, 2014 8 次提交
  2. 18 2月, 2014 15 次提交
  3. 17 2月, 2014 6 次提交
  4. 16 2月, 2014 4 次提交
  5. 15 2月, 2014 7 次提交
    • C
      Merge pull request #14069 from arunagw/aa-plugin-generator-build-fix · 4914adc2
      Carlos Antonio da Silva 提交于
      Revert "Fixed plugin_generator test"
      
      As this commit  22a1a5ac has reverted all changes so this plugin generator also needs to fix.
      4914adc2
    • A
      Revert "Fixed plugin_generator test" · 5f07366b
      Arun Agrawal 提交于
      This reverts commit fefa8ae9.
      5f07366b
    • X
    • A
      add factory methods for empty alias trackers · bfc776f7
      Aaron Patterson 提交于
      If we know the alias tracker is empty, we can create one that doesn't
      use a hash with default block for counting.
      
      ActiveRecord::Base.establish_connection(adapter: 'sqlite3',
                                              database: ':memory:')
      
      ActiveRecord::Schema.define do
        create_table :posts, force: true do |t|
          t.integer :comments_count
        end
      
        create_table :comments, force: true do |t|
          t.integer :post_id
        end
      end
      
      class Post < ActiveRecord::Base; has_many :comments; end
      class Comment < ActiveRecord::Base; belongs_to :post, counter_cache: true; end
      10.times { Comment.create!(post: Post.create!) }
      
      record = Post.first
      association_name = :comments
      
      Benchmark.ips do |x|
        reflection = record.class.reflect_on_association(association_name)
        association = reflection.association_class.new(record, reflection)
        x.report('assoc') do
          reflection.association_class.new(record, reflection)
        end
        x.report('reader') do
          association.reader;nil
        end
        x.report('combined') do
          reflection.association_class.new(record, reflection).reader;nil
        end
      end
      
      [aaron@higgins rails (tracker)]$ TEST=ips bundle exec ruby ../1bb5456b5e035343df9d/gistfile1.rb
      -- create_table(:posts, {:force=>true})
         -> 0.0062s
      -- create_table(:comments, {:force=>true})
         -> 0.0003s
      Calculating -------------------------------------
                     assoc       833 i/100ms
                    reader     28703 i/100ms
                  combined       839 i/100ms
      -------------------------------------------------
                     assoc     9010.3 (±3.8%) i/s -      44982 in   5.000022s
                    reader  3214523.4 (±5.5%) i/s -   16016274 in   5.001136s
                  combined     8841.0 (±5.8%) i/s -      44467 in   5.049269s
      
      [aaron@higgins rails (tracker)]$ TEST=ips bundle exec ruby ../1bb5456b5e035343df9d/gistfile1.rb
      -- create_table(:posts, {:force=>true})
         -> 0.0060s
      -- create_table(:comments, {:force=>true})
         -> 0.0003s
      Calculating -------------------------------------
                     assoc       888 i/100ms
                    reader     29217 i/100ms
                  combined       900 i/100ms
      -------------------------------------------------
                     assoc     9674.3 (±3.3%) i/s -      48840 in   5.054022s
                    reader  2988474.8 (±6.9%) i/s -   14842236 in   4.998230s
                  combined     9674.0 (±3.1%) i/s -      48600 in   5.028694s
      bfc776f7
    • A
    • A
      stop exposing table_joins · 494a26d7
      Aaron Patterson 提交于
      494a26d7
    • A
      make most parameters to the AliasTracker required · c24ea241
      Aaron Patterson 提交于
      This helps with our sanity.  The class is internal, we can refactor to a
      "nice" API later.
      c24ea241