1. 04 6月, 2019 2 次提交
  2. 03 6月, 2019 5 次提交
  3. 02 6月, 2019 5 次提交
  4. 01 6月, 2019 6 次提交
    • R
      Avoid making extra 5 arrays in each `save` · 613060d1
      Ryuta Kamizono 提交于
      Each `save` calls `all_timestamp_attributes_in_model` to fill timestamp
      columns. Allthough the `all_timestamp_attributes_in_model` returns the
      same value every time, the `all_timestamp_attributes_in_model` makes
      extra 5 arrays every time.
      
      This avoids the making extra 5 arrays by memoizing the result, it makes
      `save` economical and a bit faster.
      
      https://gist.github.com/kamipo/1ddad2235073f508637bf9a72d64bb83
      
      Before (2a015f6c):
      
      ```
      {["~/rails/activerecord/lib/active_record/timestamp.rb",
        76,
        :T_ARRAY]=>[1000, 0, 341, 0, 1, 13640],
       ["~/rails/activerecord/lib/active_record/timestamp.rb",
        64,
        :T_ARRAY]=>[1000, 0, 341, 0, 1, 13640],
       ["~/rails/activerecord/lib/active_record/timestamp.rb",
        80,
        :T_ARRAY]=>[1000, 0, 341, 0, 1, 13640],
       ["~/rails/activerecord/lib/active_record/timestamp.rb",
        68,
        :T_ARRAY]=>[1000, 0, 341, 0, 1, 13640],
       ["~/rails/activerecord/lib/active_record/timestamp.rb",
        73,
        :T_ARRAY]=>[1000, 0, 341, 0, 1, 13640]}
      Warming up --------------------------------------
          User.create * 10    36.000  i/100ms
      Calculating -------------------------------------
          User.create * 10    353.644  (± 7.4%) i/s -      1.764k in   5.021876s
      ```
      
      After (this change):
      
      ```
      {["~/rails/activerecord/lib/active_record/timestamp.rb",
        83,
        :T_ARRAY]=>[1, 0, 1, 1, 1, 40],
       ["~/rails/activerecord/lib/active_record/timestamp.rb",
        87,
        :T_ARRAY]=>[1, 0, 1, 1, 1, 40],
       ["~/rails/activerecord/lib/active_record/timestamp.rb",
        64,
        :T_ARRAY]=>[1, 1, 1, 1, 1, 0],
       ["~/rails/activerecord/lib/active_record/timestamp.rb",
        69,
        :T_ARRAY]=>[1, 1, 1, 1, 1, 0],
       ["~/rails/activerecord/lib/active_record/timestamp.rb",
        74,
        :T_ARRAY]=>[1, 1, 1, 1, 1, 0]}
      Warming up --------------------------------------
          User.create * 10    37.000  i/100ms
      Calculating -------------------------------------
          User.create * 10    380.063  (± 7.1%) i/s -      1.924k in   5.097917s
      ```
      613060d1
    • Y
      Merge pull request #36034 from y-yagi/fixes_35709 · 2a015f6c
      Yuji Yaginuma 提交于
      Change `ActionDispatch::Response#content_type` returning Content-Type header as it is
      2a015f6c
    • Y
      Change `ActionDispatch::Response#content_type` returning Content-Type header as it is · ea5f5096
      yuuji.yaginuma 提交于
      Since #35709, `Response#conten_type` returns only MIME type correctly.
      It is a documented behavior that this method only returns MIME type, so
      this change seems appropriate.
      https://github.com/rails/rails/blob/39de7fac0507070e3c5f8b33fbad6fced84d97ed/actionpack/lib/action_dispatch/http/response.rb#L245-L249
      
      But unfortunately, some users expect this method to return all
      Content-Type that does not contain charset. This seems to be breaking
      changes.
      
      We can change this behavior with the deprecate cycle.
      But, in that case, a method needs that include Content-Type with
      additional parameters. And that method name is probably the
      `content_type` seems to properly.
      
      So I changed the new behavior to more appropriate `media_type` method.
      And `Response#content_type` changed (as the method name) to return Content-Type
      header as it is.
      
      Fixes #35709.
      
      [Rafael Mendonça França & Yuuji Yaginuma ]
      ea5f5096
    • R
      Merge pull request #36373 from guigs/fix-table-comment-also-being-applied-to-the-primary-key-column · d3e87efe
      Ryuta Kamizono 提交于
      Fix table comment also being applied to the primary key column
      d3e87efe
    • G
    • J
      Merge pull request #36369 from jhawthorn/parallel_worker_crash · 06ae49d9
      John Hawthorn 提交于
      Fail parallel tests if workers exit early
      06ae49d9
  5. 31 5月, 2019 3 次提交
    • J
      Fail parallel tests if workers exit early · 9fd02d18
      John Hawthorn 提交于
      Previously, if a test worker exited early, the in-flight test it was
      supposed to run wasn't reported as a failure.
      
      If all workers exited immediately, this would be reported as ex.
      
          Finished in 1.708349s, 39.2192 runs/s, 79.0237 assertions/s.
          67 runs, 135 assertions, 0 failures, 0 errors, 2 skips
      
      This commit validates that all workers finish running tests by ensuring
      that the queue is empty after they exit. This works because we signal
      the workers to exit by pushing nil onto the queue, so that there should
      be a number of items left in the queue matching potentially missed
      tests.
      9fd02d18
    • G
      Add a changelog entry for 165785e8 · 5ce1f66d
      George Claghorn 提交于
      5ce1f66d
    • G
      Skip image analysis on ImageMagick error · 165785e8
      George Claghorn 提交于
      165785e8
  6. 29 5月, 2019 9 次提交
  7. 28 5月, 2019 10 次提交
    • R
    • E
      Merge pull request #36324 from yoones/fix-unexpected-select-tag-delete-behavior · 350ae296
      Eileen M. Uchitelle 提交于
      Fix unexpected select_tag delete behavior when include_blank is present
      350ae296
    • R
      Merge pull request #36352 from kamipo/fast_pluck_datetime · fc530d86
      Ryuta Kamizono 提交于
      Don't round off subseconds unless necessary
      fc530d86
    • R
    • R
      Don't round off subseconds unless necessary · 497e52f8
      Ryuta Kamizono 提交于
      Currently, if `:datetime` type has a precision, type casting always does
      round off subseconds regardless of whether necessary or not, it is a bit
      slow.
      
      Since #34970, `t.timestamps` with `precision: 6` by default, so
      `pluck(:created_at)` in newly created app will always be affected by the
      round off.
      
      This avoids the round off if possible, it makes `pluck(:created_at)`
      about 25% faster.
      
      https://gist.github.com/kamipo/e029539f2632aee9f5e711fe66fc8842
      
      Before (0a87d7c9 with postgresql adapter):
      
      ```
      Warming up --------------------------------------
          users.pluck(:id)      344.000  i/100ms
        users.pluck(:name)      336.000  i/100ms
      users.pluck(:created_at)  206.000  i/100ms
      Calculating -------------------------------------
          users.pluck(:id)      3.620k (± 8.5%) i/s -     18.232k in   5.077316s
        users.pluck(:name)      3.579k (± 9.4%) i/s -     17.808k in   5.020230s
      users.pluck(:created_at)  2.069k (± 8.0%) i/s -     10.300k in   5.019284s
      ```
      
      Before (0a87d7c9 with mysql2 adapter):
      
      ```
      Warming up --------------------------------------
          users.pluck(:id)      245.000  i/100ms
        users.pluck(:name)      240.000  i/100ms
      users.pluck(:created_at)  180.000  i/100ms
      Calculating -------------------------------------
          users.pluck(:id)      2.548k (± 9.4%) i/s -     12.740k in   5.066574s
        users.pluck(:name)      2.513k (± 8.0%) i/s -     12.480k in   5.011260s
      users.pluck(:created_at)  1.771k (±11.2%) i/s -      8.820k in   5.084473s
      ```
      
      After (this change with postgresql adapter):
      
      ```
      Warming up --------------------------------------
          users.pluck(:id)      348.000  i/100ms
        users.pluck(:name)      357.000  i/100ms
      users.pluck(:created_at)  254.000  i/100ms
      Calculating -------------------------------------
          users.pluck(:id)      3.628k (± 8.2%) i/s -     18.096k in   5.024748s
        users.pluck(:name)      3.624k (±12.4%) i/s -     17.850k in   5.020959s
      users.pluck(:created_at)  2.567k (± 7.0%) i/s -     12.954k in   5.081153s
      ```
      
      After (this change with mysql2 adapter):
      
      ```
      Warming up --------------------------------------
          users.pluck(:id)      268.000  i/100ms
        users.pluck(:name)      265.000  i/100ms
      users.pluck(:created_at)  207.000  i/100ms
      Calculating -------------------------------------
          users.pluck(:id)      2.586k (±10.9%) i/s -     12.864k in   5.050546s
        users.pluck(:name)      2.543k (±10.2%) i/s -     12.720k in   5.067726s
      users.pluck(:created_at)  2.263k (±14.5%) i/s -     10.971k in   5.004039s
      ```
      497e52f8
    • R
      Merge pull request #36350 from kamipo/fast_pluck · 0a87d7c9
      Ryuta Kamizono 提交于
      Allow symbol (i.e. quoted identifier) as safe SQL string
      0a87d7c9
    • R
      Allow symbol (i.e. quoted identifier) as safe SQL string · bc837892
      Ryuta Kamizono 提交于
      `pluck(:id)` / `order(:id)` are very common use case, and passed symbol
      (i.e. quoted identifier) is obviously safe argument, but
      `:id.to_s.split(/\s*,\s*/).all? { |part| permit.match?(part) }` is
      useless and a bit expensive operation for each such safe symbols (will
      make extra 2 mutable strings, 1 array, 1 proc).
      
      This avoids the expensive operation to such safe symbols, it makes
      `pluck(:id)` / `order(:id)` itself about 9% faster.
      
      https://gist.github.com/kamipo/11d428b57f3629a72ae89c6f21721326
      
      Before (93e64073):
      
      ```
      Warming up --------------------------------------
          users.pluck(:id)     1.217k i/100ms
      users.order(:id).to_sql  1.848k i/100ms
      Calculating -------------------------------------
          users.pluck(:id)     12.239k (± 8.2%) i/s -     60.850k in   5.013839s
      users.order(:id).to_sql  19.111k (± 7.5%) i/s -     96.096k in   5.064450s
      ```
      
      After (this change):
      
      ```
      Warming up --------------------------------------
          users.pluck(:id)     1.293k i/100ms
      users.order(:id).to_sql  2.036k i/100ms
      Calculating -------------------------------------
          users.pluck(:id)     13.257k (± 6.9%) i/s -     65.943k in   5.002568s
      users.order(:id).to_sql  20.957k (± 7.6%) i/s -    105.872k in   5.086102s
      ```
      bc837892
    • R
      Merge pull request #36348 from corprew/docs-stringify-keys-stable-result · 93e64073
      Ryuta Kamizono 提交于
      [documentation][ci skip] stringify_keys and symbolize_keys have stable results.
      93e64073
    • R
      Merge pull request #36347 from causztic/master · 5b5c6c13
      Ryuta Kamizono 提交于
      Remove unused requires from debug_exceptions
      5b5c6c13
    • C
      stringify_keys and symbolize_keys have stable results. · 82ee7a0f
      Corprew Reed 提交于
      Rails 6 uses the `Hash.transform_keys` found in Ruby 2.5 and later, and that method enumerates keys based on insertion order.  Calling `symbolize_keys`, `stringify_keys`, and their bang variants will result in the same hash every time -- the value for any key where a collision occurs is the last assigned in that enumeration
      
      In the docs for Hash --  https://ruby-doc.org/core-2.5.0/Hash.html
      
      > Hashes enumerate their values in the order that the corresponding keys were inserted.
      82ee7a0f