aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Memoize coerced TimeWithZone value in TimeWithZone#localtime.Ryan De Villa2016-08-231-7/+1
|
* Fix performance regression in `TimeWithZone#to_time`Ryan De Villa2016-08-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A performance regression was introduced by commit b79adc4323ff289aed3f5787fdfbb9542aa4f89f from Rails 4.0.0.beta1, in which `TimeWithZone#to_time` no longer returns a cached instance attribute but instead coerces the value to `Time`. This coerced value is not cached, and recomputation degrades the performance of comparisons between TimeWithZone objects. See https://github.com/rails/rails/commit/b79adc4323ff289aed3f5787fdfbb9542aa4f89f#diff-3497a506c921a3a3e40fd517e92e4fe3R322 for the change in question. The following benchmark, which reverts the change linked above, demonstrates the performance regression: require 'active_support/time' require 'benchmark/ips' utc = Time.utc(2000, 1, 1, 0) time_zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] twz = ActiveSupport::TimeWithZone.new(utc, time_zone) twz2 = ActiveSupport::TimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone['UTC']) patchedTimeWithZone = Class.new(ActiveSupport::TimeWithZone) do def to_time utc end end patched_twz = patchedTimeWithZone.new(utc, time_zone) patched_twz2 = patchedTimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone['UTC']) Benchmark.ips do |x| x.report("comparison out of the box") { twz <=> twz2 } x.report("comparison reverting to_time") { patched_twz <=> patched_twz2 } x.compare! end The results, when run in rails-dev-box, are as follows: Warming up -------------------------------------- comparison out of the box 24.765k i/100ms comparison reverting to_time 57.237k i/100ms Calculating ------------------------------------- comparison out of the box 517.245k (± 4.7%) i/s - 2.600M in 5.038700s comparison reverting to_time 2.624M (± 5.0%) i/s - 13.050M in 4.985808s Comparison: comparison reverting to_time: 2624266.1 i/s comparison out of the box: 517244.6 i/s - 5.07x slower The change made to run the benchmark, however, is not possible, as it would undo the intent to standardize the return value of `to_time` to `Time` in the system timezone. Our proposed solution is to restore the caching behaviour of `to_time` as it existed prior to the change linked above. Benchmark of our solution: require 'active_support/time' require 'benchmark/ips' patchedTimeWithZone = Class.new(ActiveSupport::TimeWithZone) do def to_time @to_time ||= super end end utc = Time.utc(2000, 1, 1, 0) time_zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] twz = ActiveSupport::TimeWithZone.new(utc, time_zone) twz2 = ActiveSupport::TimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone['UTC']) patched_twz = patchedTimeWithZone.new(utc, time_zone) patched_twz2 = patchedTimeWithZone.new(Time.utc(1999, 12, 31, 23, 59, 59), ActiveSupport::TimeZone['UTC']) Benchmark.ips do |x| x.report("TimeWithZone comparison - existing implementation") { twz <=> twz2 } x.report("TimeWithZone comparison - caching implementation") { patched_twz <=> patched_twz2 } x.compare! end Results in rails-dev-box: Warming up -------------------------------------- TimeWithZone comparison - existing implementation 26.629k i/100ms TimeWithZone comparison - caching implementation 59.144k i/100ms Calculating ------------------------------------- TimeWithZone comparison - existing implementation 489.757k (± 4.2%) i/s - 2.450M in 5.011639s TimeWithZone comparison - caching implementation 2.802M (± 5.3%) i/s - 13.958M in 4.996116s Comparison: TimeWithZone comparison - caching implementation: 2801519.1 i/s TimeWithZone comparison - existing implementation: 489756.7 i/s - 5.72x slower
* Merge pull request #26228 from kamipo/remove_unnecessary_any_and_manyRafael França2016-08-232-28/+12
|\ | | | | Remove unnecessary `any?` and `many?` methods for collection proxy
| * Remove unnecessary `any?` and `many?` methods for collection proxyRyuta Kamizono2016-08-192-28/+12
| | | | | | | | Simply use its own methods because `CollectionProxy` inherits `Relation`.
* | Merge pull request #26254 from badosu/improve-tag-optionRafael França2016-08-231-2/+2
|\ \ | | | | | | Improve #tag_option performance
| * | Improve TagHelper#tag_option performanceAmadeus Folego2016-08-221-2/+2
| | | | | | | | | | | | | | | | | | Freeze string literals and use String instead of Regex inside gsub call. This should improve performance from 20% up to 50% on most cases.
* | | Merge pull request #26205 from pedaling-corp/fix/active-job-resqueRafael Mendonça França2016-08-233-2/+16
|\ \ \ | | | | | | | | | | | | Add @queue variable to JobWrapper
| * | | Added instance variable `@queue` to JobWrapper.InJung Chung2016-08-193-0/+16
| | | | | | | | | | | | | | | | | | | | This will fix issues in [resque-scheduler](https://github.com/resque/resque-scheduler) `#job_to_hash` method, so we can use `#enqueue_delayed_selection`, `#remove_delayed` method in resque-scheduler smoothly.
* | | | Merge pull request #26253 from kamipo/fix_ci_failureRafael França2016-08-231-2/+2
|\ \ \ \ | | | | | | | | | | Fix CI failure caused by df84e9867219e9311aef6f4efd5dd9ec675bee5c
| * | | | Fix CI failure caused by df84e9867219e9311aef6f4efd5dd9ec675bee5cRyuta Kamizono2016-08-231-2/+2
| | |/ / | |/| |
* | | | Merge pull request #26231 from philipqnguyen/scoped-dependent-destroyJon Moss2016-08-221-0/+6
|\ \ \ \ | |/ / / |/| | | Doc on scoped has_many, dependent: :destroy
| * | | Doc on scoped has_many, dependent: :destroyPhilip Nguyen2016-08-221-0/+6
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | This is to close #26111 Developers need to be aware that `dependent: :destroy` on a scoped `has_many` association would only destroy the associated objects in that scope. Potentially leaving other associated objects outside that scope untouched.
* | | Include the content of the flash in the auto-generated etag (#26250)David Heinemeier Hansson2016-08-225-0/+59
| | | | | | | | | Include the content of the flash in the auto-generated etag
* | | Merge pull request #26249 from rafamanzo/add_redis_to_development_dependenciesRafael França2016-08-221-0/+43
|\ \ \ | | | | | | | | Update docs with Action Cable Redis dependency
| * | | [ci skip] Update docs with Action Cable Redis dependencyRafael Reggiani Manzo2016-08-221-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Action Cable's test `test/subscription_adapter/redis_test.rb` fail if Redis is not installed and running. Following the guides `development_dependen there's no mention to this.
* | | | Remove the SchemaDumper options and change the default behaviorRafael Mendonça França2016-08-224-137/+17
| | | | | | | | | | | | | | | | | | | | Now the schema dumper by default doesn't align the types and arguments in the ruby format anymore.
* | | | Merge pull request #26248 from wjordan/remove-dynamic-segments-docप्रथमेश Sonpatki2016-08-221-25/+11
|\ \ \ \ | | | | | | | | | | Remove `:action` and `:controller` segments from routing guide
| * | | | Remove `:action` and `:controller` segments from routing guideWill Jordan2016-08-221-25/+11
|/ / / / | | | | | | | | | | | | | | | | Fixes #26247. [ci skip]
* | | | Merge pull request #25750 from go2null/go2null-test-directoriesEileen M. Uchitelle2016-08-221-2/+4
|\ \ \ \ | |/ / / |/| | | Specified directories for routes, views and jobs tests
| * | | Clearly state purpose of test directoriesgo2null2016-08-221-2/+4
| | | | | | | | | | | | | | | | | | | | * Added location for route, view and job tests to section 2.1. (They are currently only defined in sections 8 Testing Views and 11 Testing Jobs.) * Added location for route test in section 7 Testing Routes. (Currently only defined in section 8 Testing Views.)
* | | | Merge pull request #23941 from chiragsinghal/patch-1Kasper Timm Hansen2016-08-223-1/+43
|\ \ \ \ | | | | | | | | | | Return 307 status instead of 301 when rerouting POST requests to SSL
| * | | | Return 307 status instead of 301 when rerouting POST requests to SSLChirag Singhal2016-08-223-1/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When `config.force_ssl` is set to `true`, any POST/PUT/DELETE requests coming in to non-secure url are being redirected with a 301 status. However, when that happens, the request is converted to a GET request and ends up hitting a different action on the controller. Since we can not do non-GET redirects, we can instead redirect with a 307 status code instead to indicate to the caller that a fresh request should be tried preserving the original request method. `rack-ssl` gem which was used to achieve this before we had this middleware directly baked into Rails also used to do the same, ref: https://github.com/josh/rack-ssl/blob/master/lib/rack/ssl.rb#L54 This would be specially important for any apps switching from older version of Rails or apps which expose an API through Rails.
* | | | | Merge pull request #26245 from danila/quering-interface-guideVipul A M2016-08-221-2/+2
|\ \ \ \ \ | |/ / / / |/| | | | Change form of table name to plural in quering interface guides [ci skip]
| * | | | Change form of table name to plural in query exampleDanila Ermakov2016-08-221-2/+2
|/ / / /
* | | | Merge pull request #26240 from ojiry/fix_ad_http_url_docप्रथमेश Sonpatki2016-08-221-65/+21
|\ \ \ \ | | | | | | | | | | Fix `ActionDispatch::Http::URL` docs [ci skip]
| * | | | Fix `ActionDispatch::Http::URL` docs [ci skip]Ryoji Yoshioka2016-08-221-65/+21
| | | | | | | | | | | | | | | | | | | | Use ActionDispatch::Request instead of Request because ActionDispatch::Request no longer inherits from Rack::Request.
* | | | | Merge pull request #26241 from scottyantipa/query-interface-docsJon Moss2016-08-211-3/+3
|\ \ \ \ \ | | | | | | | | | | | | Upate guides to properly define return values of finder methods
| * | | | | Update docs for query interface to not declare that all methods return ↵Scott Antipa2016-08-211-3/+3
| |/ / / / | | | | | | | | | | | | | | | instance of ActiveRecord::Relation
* | | | | Merge pull request #23759 from maclover7/fix-23757Kasper Timm Hansen2016-08-212-1/+16
|\ \ \ \ \ | | | | | | | | | | | | Prevent invocation of channel action if rejected connection
| * | | | | Prevent invocation of channel action if rejected connectionJon Moss2016-08-192-1/+16
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #23757. Before this commit, even if `reject` was called in the `subscribe` method for an Action Cable channel, all actions on that channel could still be invoked. This calls a `return` if a rejected connection tries to invoke any actions on the channel.
* | | | | Merge pull request #26234 from y-yagi/remove_unnessary_session_store_settingKasper Timm Hansen2016-08-211-1/+0
|\ \ \ \ \ | |_|/ / / |/| | | | remove unnessary `session_store` setting
| * | | | remove unnessary `session_store` settingyuuji.yaginuma2016-08-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Since e5a6f7ee9e951dbe0e4e9ea2c0743b4dfb135c57, by default the session store will be set to cookie store with application name as session key.
* | | | | Merge branch 'master' of github.com:rails/docrailsVijay Dev2016-08-215-8/+8
|\ \ \ \ \
| * | | | | When referring to Rails, be consistent in usage of capitalized form, unless ↵Vipul A M2016-08-193-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | it is used in context of a command like bin/rails or the rails directory [ci skip]
| * | | | | Grammar changes on getting started guide, specify where exactly the example ↵Vipul A M2016-08-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | is that we are referring to. [ci skip]
| * | | | | Fix remaining broadcasting_name example from Action Cable guide [ci skip]Prathamesh Sonpatki2016-08-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | - Followup of https://github.com/rails/rails/pull/26125.
* | | | | | Merge pull request #26227 from alexcameron89/syntax_highlighter_fixVijay Dev2016-08-201-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | Increase margin-bottom for doc's code syntax highlighter
| * | | | | | Increase margin-bottom for doc's code syntax highlighterAlex Kitchens2016-08-201-1/+1
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #25744 by slightly increasing the margin in code syntax highlights. With a margin of 0, it was cutting off underscores in Linux browesers, so I slightly increased it to 0.5px.
* | | | | | Merge pull request #26232 from kamipo/fix_oid_bit_cast_valueSean Griffin2016-08-202-4/+5
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fix `OID::Bit#cast_value`
| * | | | | | Fix `OID::Bit#cast_value`Ryuta Kamizono2016-08-202-4/+5
| |/ / / / / | | | | | | | | | | | | | | | | | | Fixes #26137.
* | | | | | Merge pull request #26233 from y-yagi/update_retry_on_exampleप्रथमेश Sonpatki2016-08-201-2/+2
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | correct exception class in `retry_on` example [ci skip]
| * | | | | correct exception class in `retry_on` example [ci skip]yuuji.yaginuma2016-08-201-2/+2
|/ / / / / | | | | | | | | | | | | | | | | | | | | If the deadlock has occurred `ActiveRecord::Deadlocked` will raise. Ref: #25107, #26059
* | | | | Merge pull request #26224 from jonatack/consistent-asset-precompile-examplesEileen M. Uchitelle2016-08-195-10/+11
|\ \ \ \ \ | |/ / / / |/| | | | Consistent examples and template for assets#precompile
| * | | | Consistent examples and template for assets#precompileJon Atack2016-08-195-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Listening to a few developers today discussing their troubles in understanding how to use the asset pipeline, it turns out that the precompile examples in the guides and assets.rb template have over time become a bit inconsistent. This PR makes the examples consistent in code style, spacing, and asset names, removes the old 'swfObject.js' example, and in a couple of places wraps lines at 80 characters including in the assets.rb template. Re-add spaces inside array parentheses.
* | | | | Merge pull request #26219 from kamipo/remove_unused_blob_or_text_columnRafael França2016-08-192-9/+0
|\ \ \ \ \ | | | | | | | | | | | | Remove unused `blob_or_text_column?` method
| * | | | | Remove unused `blob_or_text_column?` methodRyuta Kamizono2016-08-192-9/+0
| | | | | |
* | | | | | Merge pull request #26218 from kamipo/remove_unnecessary_lengthRafael França2016-08-192-12/+6
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Remove unnecessary `length` method for collection proxy
| * | | | | Remove unnecessary `length` method for collection proxyRyuta Kamizono2016-08-192-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `length` is delegated to `records` (`load_target`) by `ActiveRecord::Delegation`. https://github.com/rails/rails/blob/v5.0.0/activerecord/lib/active_record/relation/delegation.rb#L38
* | | | | | Copy edits in the documentation [ci skip]Rafael Mendonça França2016-08-192-4/+6
| | | | | |
* | | | | | Merge pull request #26212 from ↵Rafael França2016-08-193-1/+22
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | evmunro/as-json-sets-request-to-json-for-controller-test Allow setting of request CONTENT-TYPE with as: in controller tests