| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
It makes to ease to handle all short-hand methods (e.g. validates
arguments etc).
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
`object.transform_values!` returns `object` itself.
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
`Association#target=` invokes `loaded!`, so we no longer need to call
the `loaded!` explicitly.
Since Preloader is private API, we don't guarantee that it behaves like
older version as long as using Preloader directly. But this refactoring
fortunately also fix the Preloader compatibility issue #35195.
Closes #35195.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Fix elapsed time calculations
|
| |/ / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
I've found a few places in Rails code base where I think it makes sense
to calculate elapsed time more precisely by using
`Concurrent.monotonic_time`:
- Fix calculation of elapsed time in `ActiveSupport::Cache::MemoryStore#prune`
- Fix calculation of elapsed time in
`ActiveRecord::ConnectionAdapters::ConnectionPool::Queue#wait_poll`
- Fix calculation of elapsed time in
`ActiveRecord::ConnectionAdapters::ConnectionPool#attempt_to_checkout_all_existing_connections`
- Fix calculation of elapsed time in `ActiveRecord::ConnectionAdapters::Mysql2Adapter#explain`
See
https://docs.ruby-lang.org/en/2.5.0/Process.html#method-c-clock_gettime
https://blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way
Related to 7c4542146f0dde962205e5a90839349631ae60fb
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Fix `relation.exists?` with giving both `distinct` and `offset`
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
The `distinct` affects (reduces) rows of the result, so it is important
part when both `distinct` and `offset` are given.
Replacing SELECT clause to `1 AS one` and removing `distinct` and
`order` is just optimization for the `exists?`, we should not apply the
optimization for that case.
Fixes #35191.
|
|\ \ \ \ \ \ \
| |/ / / / / /
|/| | | | | | |
Bugfix has_many association #size when ids reader is cached and assoc…
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
is changed
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Relation is not best place to do this.
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Address test_belongs_to_does_not_use_order_by failure
|
|/ / / / / / /
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
order by for metadata queries
Also, `test_has_one_does_not_use_order_by` should not check metadata queries.
Fixes #35098
|
|\ \ \ \ \ \ \
| |_|_|_|/ / /
|/| | | | | | |
Finish rename of database_operations to database_resolver_context
|
| | | | | | | |
|
|/ / / / / / |
|
|\ \ \ \ \ \
| |_|/ / / /
|/| | | | | |
Improve naming in DatabaseSelector
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
We're already in the resolver, we call this class "operations" in the
middleware, so we should use the same naming here.
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This is more consistent with Resolver, which has build called. This
allows using a Proc instead of a class, which could be nice if you need
to vary switching logic based on the request in a more ad-hoc way (ie.
check if it is an API request).
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Fix `relation.create` to avoid leaking scope to initialization block and callbacks
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
callbacks
`relation.create` populates scope attributes to new record by `scoping`,
it is necessary to assign the scope attributes to the record and to find
STI subclass from the scope attributes.
But the effect of `scoping` is class global, it was caused undesired
behavior that pollute all class level querying methods in initialization
block and callbacks (`after_initialize`, `before_validation`,
`before_save`, etc), which are user provided code.
To avoid the leaking scope issue, restore the original current scope
before initialization block and callbacks are invoked.
Fixes #9894.
Fixes #17577.
Closes #31526.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Don't use `false` as special value to skip to find inherited scope, we
could use `skip_inherited_scope = true`, and move `_scoping` back on
Relation.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Move compiled ERB to an AV::Base subclass
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Revert "Remove finalizer and configuration"
This reverts commit 9e7b4a3173788ea43b11e74a4d2f69a5f1565daa.
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Then we don't need the extra module.
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Now we can throw away the subclass and the generated methods will get
GC'd too
|
| |/ / / /
|/| | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Fix `CollectionProxy#concat` to return self by alias it to `#<<`
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Formerly it was returning arguments (`records` array).
|
|\ \ \ \ \ \
| |_|_|_|/ /
|/| | | | | |
Improve execution time of railties' test
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
To avoid running require individually.
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | | |
For avoid to affect tests. Also, `action_text:install` task execute
`yarn add`. This is an expensive and should be avoided if it is not needed.
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Update terminal-to-html inline images url in ScreenshotHelper documentation
|
|/ / / / |
|
|\ \ \ \
| |/ / /
|/| | | |
Fix incorrectly matching unanchored paths
|
| | | | |
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Speed up partial rendering by caching "variable" calculation
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This commit speeds up rendering partials by caching the variable name
calculation on the template. The variable name is based on the "virtual
path" used for looking up the template. The same virtual path
information lives on the template, so we can just ask the cached
template object for the variable.
This benchmark takes a couple files, so I'll cat them below:
```
[aaron@TC ~/g/r/actionview (speed-up-partials)]$ cat render_benchmark.rb
require "benchmark/ips"
require "action_view"
require "action_pack"
require "action_controller"
class TestController < ActionController::Base
end
TestController.view_paths = [File.expand_path("test/benchmarks")]
controller_view = TestController.new.view_context
result = Benchmark.ips do |x|
x.report("render") do
controller_view.render("many_partials")
end
end
[aaron@TC ~/g/r/actionview (speed-up-partials)]$ cat test/benchmarks/test/_many_partials.html.erb
Looping:
<ul>
<% 100.times do |i| %>
<%= render partial: "list_item", locals: { i: i } %>
<% end %>
</ul>
[aaron@TC ~/g/r/actionview (speed-up-partials)]$ cat test/benchmarks/test/_list_item.html.erb
<li>Number: <%= i %></li>
```
Benchmark results (master):
```
[aaron@TC ~/g/r/actionview (master)]$ be ruby render_benchmark.rb
Warming up --------------------------------------
render 41.000 i/100ms
Calculating -------------------------------------
render 424.269 (± 3.5%) i/s - 2.132k in 5.031455s
```
Benchmark results (this branch):
```
[aaron@TC ~/g/r/actionview (speed-up-partials)]$ be ruby render_benchmark.rb
Warming up --------------------------------------
render 50.000 i/100ms
Calculating -------------------------------------
render 521.862 (± 3.8%) i/s - 2.650k in 5.085885s
```
|