rails/activesupport
Akira Matsuda 8b2f57dc6f
Let delegate define method with proper arity when delegating to a Class / Module
Method delegation with `...` argument is known to be slow because it allocates
redundant Array and Hash objects each time when being called.
see: https://bugs.ruby-lang.org/issues/19165

Current implementation of `delegate` defines all delegation methods in this
slow form regardless of the original method's arity, but in case the delegation
target is a Class or a Module, we can investigate the arity of the original
method in the definition timing, then we can define the delegation in proper
minimal arity.

This makes 3.5 times faster zero arity method delegation as follows:
Warming up --------------------------------------
                 old   811.534k i/100ms
                 new     1.807M i/100ms
Calculating -------------------------------------
                 old      9.809M (± 3.4%) i/s -     49.504M in   5.053355s
                 new     34.360M (± 0.8%) i/s -    173.465M in   5.048692s

Comparison:
                 new: 34360408.4 i/s
                 old:  9809157.4 i/s - 3.50x  (± 0.00) slower
2023-01-11 04:32:08 +09:00
..
bin Remove AS::Multibyte's unicode table 2018-02-20 03:58:22 +09:00
lib Let delegate define method with proper arity when delegating to a Class / Module 2023-01-11 04:32:08 +09:00
test Let delegate define method with proper arity when delegating to a Class / Module 2023-01-11 04:32:08 +09:00
.gitignore Clean up and consolidate .gitignores 2018-02-17 14:26:19 -08:00
activesupport.gemspec Enable connection pooling by default for MemCacheStore and RedisCacheStore 2022-06-07 11:40:17 +03:00
CHANGELOG.md Let delegate define method with proper arity when delegating to a Class / Module 2023-01-11 04:32:08 +09:00
MIT-LICENSE Bump license years to 2022 [ci-skip] 2022-01-01 15:22:15 +09:00
Rakefile Stop testing hiredis 2022-08-22 09:01:27 +02:00
README.rdoc Rename master to main in all code references 2021-01-19 20:46:33 +00:00

= Active Support -- Utility classes and Ruby extensions from Rails

Active Support is a collection of utility classes and standard library
extensions that were found useful for the Rails framework. These additions
reside in this package so they can be loaded as needed in Ruby projects
outside of Rails.

You can read more about the extensions in the {Active Support Core Extensions}[https://edgeguides.rubyonrails.org/active_support_core_extensions.html] guide.

== Download and installation

The latest version of Active Support can be installed with RubyGems:

  $ gem install activesupport

Source code can be downloaded as part of the Rails project on GitHub:

* https://github.com/rails/rails/tree/main/activesupport


== License

Active Support is released under the MIT license:

* https://opensource.org/licenses/MIT


== Support

API documentation is at:

* https://api.rubyonrails.org

Bug reports for the Ruby on Rails project can be filed here:

* https://github.com/rails/rails/issues

Feature requests should be discussed on the rails-core mailing list here:

* https://discuss.rubyonrails.org/c/rubyonrails-core