| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|\
| |
| | |
Remove unnecessary `any?` and `many?` methods for collection proxy
|
| |
| |
| |
| | |
Simply use its own methods because `CollectionProxy` inherits `Relation`.
|
|\ \
| | |
| | | |
Improve #tag_option performance
|
| | |
| | |
| | |
| | |
| | |
| | | |
Freeze string literals and use String instead of
Regex inside gsub call. This should improve performance from 20% up to
50% on most cases.
|
|\ \ \
| | | |
| | | |
| | | | |
Add @queue variable to JobWrapper
|
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
|\ \ \ \
| | | | |
| | | | | |
Fix CI failure caused by df84e9867219e9311aef6f4efd5dd9ec675bee5c
|
| | |/ /
| |/| | |
|
|\ \ \ \
| |/ / /
|/| | | |
Doc on scoped has_many, dependent: :destroy
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
|\ \ \
| | | |
| | | | |
Update docs with Action Cable Redis dependency
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Now the schema dumper by default doesn't align the types and arguments
in the ruby format anymore.
|
|\ \ \ \
| | | | |
| | | | | |
Remove `:action` and `:controller` segments from routing guide
|
|/ / / /
| | | |
| | | |
| | | |
| | | | |
Fixes #26247.
[ci skip]
|
|\ \ \ \
| |/ / /
|/| | | |
Specified directories for routes, views and jobs tests
|
| | | |
| | | |
| | | |
| | | |
| | | | |
* 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.)
|
|\ \ \ \
| | | | |
| | | | | |
Return 307 status instead of 301 when rerouting POST requests to SSL
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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.
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Change form of table name to plural in quering interface guides [ci skip]
|
|/ / / / |
|
|\ \ \ \
| | | | |
| | | | | |
Fix `ActionDispatch::Http::URL` docs [ci skip]
|
| | | | |
| | | | |
| | | | |
| | | | | |
Use ActionDispatch::Request instead of Request because ActionDispatch::Request no longer inherits from Rack::Request.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Upate guides to properly define return values of finder methods
|
| |/ / / /
| | | | |
| | | | |
| | | | | |
instance of ActiveRecord::Relation
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Prevent invocation of channel action if rejected connection
|
| | |_|/ /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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.
|
|\ \ \ \ \
| |_|/ / /
|/| | | | |
remove unnessary `session_store` setting
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Since e5a6f7ee9e951dbe0e4e9ea2c0743b4dfb135c57, by default the session store
will be set to cookie store with application name as session key.
|
|\ \ \ \ \ |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
it is used in context of a command like bin/rails or the rails directory [ci skip]
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
is that we are referring to. [ci skip]
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
- Followup of https://github.com/rails/rails/pull/26125.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Increase margin-bottom for doc's code syntax highlighter
|
| | |_|/ / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
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.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Fix `OID::Bit#cast_value`
|
| |/ / / / /
| | | | | |
| | | | | |
| | | | | | |
Fixes #26137.
|
|\ \ \ \ \ \
| |_|_|/ / /
|/| | | | | |
correct exception class in `retry_on` example [ci skip]
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | | |
If the deadlock has occurred `ActiveRecord::Deadlocked` will raise.
Ref: #25107, #26059
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Consistent examples and template for assets#precompile
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Remove unused `blob_or_text_column?` method
|
| | | | | | |
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
Remove unnecessary `length` method for collection proxy
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
`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
|
| | | | | | |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
evmunro/as-json-sets-request-to-json-for-controller-test
Allow setting of request CONTENT-TYPE with as: in controller tests
|