1. 06 5月, 2020 1 次提交
  2. 01 5月, 2020 6 次提交
  3. 30 4月, 2020 5 次提交
  4. 29 4月, 2020 10 次提交
  5. 28 4月, 2020 2 次提交
    • R
      Improve performance for `scope_for_create` · b66235d4
      Ryuta Kamizono 提交于
      ```ruby
      class Post < ActiveRecord::Base
      end
      
      posts = Post.where(id: 1, title: "foo")
      
      Benchmark.ips do |x|
        x.report("scope_for_create") { posts.scope_for_create }
      end
      ```
      
      Before:
      
      ```
      Warming up --------------------------------------
          scope_for_create    30.125k i/100ms
      Calculating -------------------------------------
          scope_for_create    334.033k (± 4.4%) i/s -      1.687M in   5.060493s
      ```
      
      After:
      
      ```
      Warming up --------------------------------------
          scope_for_create    35.088k i/100ms
      Calculating -------------------------------------
          scope_for_create    388.603k (±11.8%) i/s -      1.930M in   5.080998s
      ```
      b66235d4
    • R
      Refactor Arel node `Casted`, `Quoted`, and `BindParam` · 280d6eb2
      Ryuta Kamizono 提交于
      Define `value_for_database` and `value_before_type_cast` methods, and
      use those.
      280d6eb2
  6. 27 4月, 2020 11 次提交
  7. 26 4月, 2020 3 次提交
  8. 25 4月, 2020 2 次提交
    • A
      Skip test cases for upsert_all on relation if database adapter doesn't support... · 47b17f29
      Abhay Nikam 提交于
      Skip test cases for upsert_all on relation if database adapter doesn't support update on duplicate records
      47b17f29
    • R
      Improve `WhereClause#ast` to make concise Arel ast · 699b64ab
      Ryuta Kamizono 提交于
      If only one Arel node exist, wrapping a node by `And` node is obviously
      redundant, make concise Arel ast will improve performance for visiting
      the ast (about 20% faster for complex ast case).
      
      ```ruby
      class Post < ActiveRecord::Base
      end
      
      posts = (0..500).map { |i| Post.where(id: i) }
      
      Benchmark.ips do |x|
        x.report("inject scopes") { posts.inject { |res, scope| res.or(scope) }.to_sql }
      end
      ```
      
      Before:
      
      ```
      Warming up --------------------------------------
            where with ids     8.000  i/100ms
      Calculating -------------------------------------
            where with ids     80.416  (± 2.5%) i/s -    408.000  in   5.078118s
      ```
      
      After:
      
      ```
      Warming up --------------------------------------
            where with ids     9.000  i/100ms
      Calculating -------------------------------------
            where with ids     96.126  (± 2.1%) i/s -    486.000  in   5.058960s
      ```
      699b64ab