| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |/ / / / / / / |
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
It is temporary until we do the final release
|
|\ \ \ \ \ \ \ \
| |/ / / / / / /
|/| | | | | | | |
Update single table inheritance link anchor
|
|/ / / / / / /
| | | | | | |
| | | | | | | |
The current one is old-of-date and doesn't make the browser navigation to the correct heading.
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Remove RUNNING UNIT TESTS from ActionPack
|
|/ / / / / / /
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
[ci skip]
Following discussion with @senny https://github.com/rails/rails/pull/17100#issuecomment-57285273
it only makes sense to keep this file form projects that require
extra instructions.
|
| |_|/ / / /
|/| | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
References f92ac24.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Parse HTML as document fragment.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
This is to match the changes in Rails Dom Testing rails/rails-dom-testing#20.
|
|\ \ \ \ \ \ \
| |/ / / / / /
|/| | | | | |
| | | | | | |
| | | | | | | |
phiggins/remove-dynamic-send-on-built-in-callbacks
Reduce allocations when running AR callbacks.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Inspired by @tenderlove's work in
c363fff29f060e6a2effe1e4bb2c4dd4cd805d6e, this reduces the number of
strings allocated when running callbacks for ActiveRecord instances. I
measured that using this script:
```
require 'objspace'
require 'active_record'
require 'allocation_tracer'
ActiveRecord::Base.establish_connection adapter: "sqlite3",
database: ":memory:"
ActiveRecord::Base.connection.instance_eval do
create_table(:articles) { |t| t.string :name }
end
class Article < ActiveRecord::Base; end
a = Article.create name: "foo"
a = Article.find a.id
N = 10
result = ObjectSpace::AllocationTracer.trace do
N.times { Article.find a.id }
end
result.sort.each do |k,v|
p k => v
end
puts "total: #{result.values.map(&:first).inject(:+)}"
```
When I run this against master and this branch I get this output:
```
pete@balloon:~/projects/rails/activerecord$ git checkout master
M Gemfile
Switched to branch 'master'
pete@balloon:~/projects/rails/activerecord$ bundle exec ruby benchmark_allocation_with_callback_send.rb > allocations_before
pete@balloon:~/projects/rails/activerecord$ git checkout remove-dynamic-send-on-built-in-callbacks
M Gemfile
Switched to branch 'remove-dynamic-send-on-built-in-callbacks'
pete@balloon:~/projects/rails/activerecord$ bundle exec ruby benchmark_allocation_with_callback_send.rb > allocations_after
pete@balloon:~/projects/rails/activerecord$ diff allocations_before allocations_after
39d38
<
{["/home/pete/projects/rails/activesupport/lib/active_support/callbacks.rb",
81]=>[40, 0, 0, 0, 0, 0]}
42c41
< total: 630
---
> total: 590
```
In addition to this, there are two micro-optimizations present:
* Using `block.call if block` vs `yield if block_given?` when the block was being captured already.
```
pete@balloon:~/projects$ cat benchmark_block_call_vs_yield.rb
require 'benchmark/ips'
def block_capture_with_yield &block
yield if block_given?
end
def block_capture_with_call &block
block.call if block
end
def no_block_capture
yield if block_given?
end
Benchmark.ips do |b|
b.report("block_capture_with_yield") { block_capture_with_yield }
b.report("block_capture_with_call") { block_capture_with_call }
b.report("no_block_capture") { no_block_capture }
end
pete@balloon:~/projects$ ruby benchmark_block_call_vs_yield.rb
Calculating -------------------------------------
block_capture_with_yield
124979 i/100ms
block_capture_with_call
138340 i/100ms
no_block_capture 136827 i/100ms
-------------------------------------------------
block_capture_with_yield
5703108.9 (±2.4%) i/s - 28495212 in 4.999368s
block_capture_with_call
6840730.5 (±3.6%) i/s - 34169980 in 5.002649s
no_block_capture 5821141.4 (±2.8%) i/s - 29144151 in 5.010580s
```
* Defining and calling methods instead of using send.
```
pete@balloon:~/projects$ cat benchmark_method_call_vs_send.rb
require 'benchmark/ips'
class Foo
def tacos
nil
end
end
my_foo = Foo.new
Benchmark.ips do |b|
b.report('send') { my_foo.send('tacos') }
b.report('call') { my_foo.tacos }
end
pete@balloon:~/projects$ ruby benchmark_method_call_vs_send.rb
Calculating -------------------------------------
send 97736 i/100ms
call 151142 i/100ms
-------------------------------------------------
send 2683730.3 (±2.8%) i/s - 13487568 in 5.029763s
call 8005963.9 (±2.7%) i/s - 40052630 in 5.006604s
```
The result of this is making typical ActiveRecord operations slightly faster:
https://gist.github.com/phiggins/e46e51dcc7edb45b5f98
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Use Hash#each_key instead of Hash#keys.each
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Hash#keys.each allocates an array of keys; Hash#each_key iterates through the
keys without allocating a new array. This is the reason why Hash#each_key
exists.
|
|\ \ \ \ \ \ \ \
| |/ / / / / / /
|/| | | | | | | |
correct filename for jobs tests
|
| |/ / / / / / |
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Remove defunct ivars
|
|/ / / / / / /
| | | | | | |
| | | | | | |
| | | | | | | |
@column_names_with_alias, @dynamic_methods_hash, @time_zone_column_names, and @cached_time_zone
|
|\ \ \ \ \ \ \
| |/ / / / / /
|/| | | | | | |
technical correction in guides under 'Generating an engine' [ci skip]
|
|/ / / / / /
| | | | | |
| | | | | |
| | | | | | |
`bin/rails` would not exist outside of a rails project
|
|\ \ \ \ \ \ |
|
| | | | | | | |
|
| | | | | | | |
|
| | | | | | | |
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
builder
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Follow up of #16722.
https://github.com/rails/rails/pull/16722
also normalize all instance gained methods’ sentence.
|
| | | | | | |
| | | | | | |
| | | | | | | |
Revert method documentation moved from migrations.md to active_record_migrations.md
|
| | | | | | |
| | | | | | |
| | | | | | | |
Reversible method documentation moved from migrations.md to active_record_migrations.md
|
|\ \ \ \ \ \ \
| |_|/ / / / /
|/| | | | | | |
Decrease backtrace cleaner object allocations
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Right now BenchmarkCleaner allocates hundreds of strings on every request with an exception. This patch moves those strings to be generated at boot once and re-used.
## Bench Methods
I took a modified form of CodeTriage https://github.com/schneems/codetriage-ko1-test-app/blob/master/perf.rake and ran given rake tasks with and without the patch to BacktraceCleaner.
I made an endpoint results in exception
```
def index
raise “foo"
end
```
The gem `memory_profiler` was used to capture objects allocated for a single request. Then `benchmark/ips` was used to test the speed of the patch.
You will see that we use less objects and the code becomes measurably faster with this patch.
## With patch:
Memory for one request:
```
Total allocated 7441
Total retained 37
```
Requests per second:
```
Calculating -------------------------------------
ips 4 i/100ms
-------------------------------------------------
ips 43.0 (±4.7%) i/s - 216 in 5.037733s
```
## Without patch:
Memory used for one request:
```
Total allocated 11599
Total retained 35
```
Requests per second:
```
Calculating -------------------------------------
ips 3 i/100ms
-------------------------------------------------
ips 39.4 (±7.6%) i/s - 198 in 5.052783s
```
## Analysis
The patch is faster:
```
(43.0 - 39.4 ) / 39.4 * 100
# => 9 # % ~ speed bump
```
It also allocates less objects:
```
11599 - 7441
# => 4158
```
These strings are allocated on __EVERY SINGLE REQUEST__. This patch saves us 4158 objects __PER REQUEST__ with exception.
Faster errors == Faster applications
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
* Fix a typo
* Remove references to Rails version
* Remove an extra whitespace
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
In passing, avoid a blind retry in QC: instead, just fix the problem.
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Fix typo in upgrading guide
|
|/ / / / / / /
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
- [ci skip]
- behvaior -> behavior
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Fix some typos in ActiveJob
|
|/ / / / / / /
| | | | | | |
| | | | | | |
| | | | | | | |
[ci skip]
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Fix typo in AR changelog [ci skip]
|
|/ / / / / / /
| | | | | | |
| | | | | | |
| | | | | | | |
- middlware -> middleware
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Benchmark:
```ruby
require 'objspace'
require 'active_record'
ActiveRecord::Base.establish_connection adapter: "sqlite3",
database: ":memory:"
ActiveRecord::Base.connection.instance_eval do
create_table(:articles) { |t| t.string :name }
end
class Article < ActiveRecord::Base; end
a = Article.create name: "foo"
a = Article.find a.id
N = 10
ObjectSpace::AllocationTracer.trace do
N.times { Article.find a.id }
end
ObjectSpace::AllocationTracer.allocated_count_table
table.sort_by { |_,x| x }.each do |k,v|
p k => (v / N)
end
```
|
|\ \ \ \ \ \ \
| | |_|/ / / /
| |/| | | | | |
[ci skip] fix typo in set examples
|
|/ / / / / / |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Add documentation about rescue_responses in Configuring [ci skip]
|
|/ / / / / /
| | | | | |
| | | | | |
| | | | | | |
[ci skip]
|
| | | | | | |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Don’t require already required modules
|
|/ / / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
abstract_unit.rb requires `action_controller` which [already includes the following lines of code](https://github.com/rails/rails/blob/64fcdce1d3a6a8768ab17f3be144270456814f82/actionpack/lib/action_controller.rb#L2L3):
```ruby
require 'abstract_controller'
require 'action_dispatch'
```
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Add +variants to ActionView::FileSystemResolver documentation.
|
|/ / / / / / |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This reverts commit 9d05d6de52871e57bfbf54a60de005e8a5f5b0e4, reversing
changes made to 0863c9248fd47a15e88e05ce4fcd80966684c0e3.
The change in the behaviour reported at #16958 doesn't exist since 4.0
and 4.1 works in the same way
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
remove extra # in css
|