This avoids an extra allocation from `map`.
__Benchmark__
```ruby
# frozen_string_literal: true
require "benchmark/ips"
require "active_support/all"
Hash.alias_method(:old_values_at, :values_at)
Hash.alias_method(:new_values_at, :values_at)
class ActiveSupport::HashWithIndifferentAccess
def old_values_at(*keys)
super(*keys.map { |key| convert_key(key) })
end
def new_values_at(*keys)
keys.map! { |key| convert_key(key) }
super
end
end
hwia = { foo: 1, bar: 2, baz: 3, qux: 4 }.with_indifferent_access
splat_keys = [:bar, :baz]
Benchmark.ips do |x|
x.report("old values_at 1") do
hwia.old_values_at(:bar)
end
x.report("new values_at 1") do
hwia.new_values_at(:bar)
end
x.compare!
end
Benchmark.ips do |x|
x.report("old values_at splat") do
hwia.old_values_at(*splat_keys)
end
x.report("new values_at splat") do
hwia.new_values_at(*splat_keys)
end
x.compare!
end
```
__Results__
```
Warming up --------------------------------------
old values_at 1 150.881k i/100ms
new values_at 1 163.731k i/100ms
Calculating -------------------------------------
old values_at 1 1.509M (± 1.3%) i/s - 7.695M in 5.099286s
new values_at 1 1.646M (± 1.1%) i/s - 8.350M in 5.072959s
Comparison:
new values_at 1: 1646260.9 i/s
old values_at 1: 1509283.6 i/s - 1.09x (± 0.00) slower
Warming up --------------------------------------
old values_at splat 110.815k i/100ms
new values_at splat 118.871k i/100ms
Calculating -------------------------------------
old values_at splat 1.118M (± 1.3%) i/s - 5.652M in 5.057480s
new values_at splat 1.194M (± 0.9%) i/s - 6.062M in 5.077104s
Comparison:
new values_at splat: 1194171.4 i/s
old values_at splat: 1117670.4 i/s - 1.07x (± 0.00) slower
```
* Change dockerfile from using Node 19 to match dev environment
This is accomplished via installing volta: https://volta.sh/.
Also:
* decouple the installation of libvips from node
* add installation of the node_modules by running yarn
This pull request is part one of many intended to add features
from fly.io's generated Dockerfiles that are of general interest
to Rails. For the overall plan, see:
https://community.fly.io/t/preparations-for-rails-7-1/9512
I'm making these changes in stages so that I can get early feedback
and in so doing improve future pull requests.
This changes was tested by generating an new application with esbuild
and deploying it.
attn: @ddh
* switch to double quotes to placate Rubocop
* add some Dockerfile tests
* generate a .node-version file if using_node?
* remove this for now
* reduce the number of layers
also adopt some of the style conventions already in use in the
Dockerfile with respect to quoting and spacing.
* add changelog entry
Since Sidekiq 7.0 requires Ruby 2.7, older versions of Rails that
support older Rubies are still tested against Sidekiq 6.x.
Sidekiq::MAJOR was added in 7.0 so it can't be used for version testing,
see 862dc5b
The config change is due to changes in Sidekiq 6.5. These were accounted
for in 7a069dc but removed in 6d31993.
In #33418, documentation from `ActionView::Helpers::RenderingHelper#render`
was copied to `ActionController::Renderer#render` with the intention of
documenting `ActionController::Rendering#render`. Since then, further
documentation has been added to `ActionController::Renderer#render`, and
`ActionController::Renderer#render` has been mistaken for
`ActionController::Rendering#render` (for example, in #46045).
This commit adds documentation to `ActionController::Rendering#render`
(which was previously `:nodoc:` because it is a simple override of
`AbstractController::Rendering#render`), and updates related
documentation to point to `ActionController::Rendering#render`.
The w3.org RFC 2616 page displays an obtrusive "This document has been
superseded" overlay. In regard to the `Cache-Control` header, RFC 2616
has been superseded by RFC 7234, which, in turn, has been superseded by
RFC 9111.
Therefore, this commit replaces links to RFC 2616 with links to either
MDN or RFC 9111.
When joining or eager loading an association with a parameterized scope,
the scope block will not be called with a `nil` argument. Rather,
`ActiveRecord::Reflection::AssociationReflection#check_eager_loadable!`
will raise an `ArgumentError`.
Closes#43539.
Co-authored-by: jcoleman <james.coleman@getbraintree.com>
This clarifies the `ActiveSupport::ParameterFilter` documentation, and
tweaks the example code to be more friendly to the syntax highlighter
(similar to the tweaks made for `ActionDispatch::Http::FilterParameters`
in 782bed5d45).
This also trims the `ActionDispatch::Http::FilterParameters`
documentation, and links it to `ActiveSupport::ParameterFilter`, since
`ActiveSupport::ParameterFilter` is responsible for filter behavior.
This is in line with transitioning away from the global
`ActiveSupport::Deprecation` instance, towards individual
`ActiveSupport::Deprecation` instances.
Prior to this commit, the list of RFCs and URLs was jumbled in a single
paragraph (with no delimiters) that was associated with the `RFC2616`
constant.
This commit splits up the list, associating each RFC with its respective
constant, and incorporating each URL into a link.
This matches the indentation used in generated code, such as code from
`railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt`.