mirror of https://github.com/rails/rails
1962e8d735
Full benchmark: https://gist.github.com/casperisfine/539e310eadd0cb6 Followup: https://github.com/rails/rails/pull/37903 Instead of always redefining a bmethod on assignment, if the reciever already has its own bmethod, we just update the local variable. This wasn't really considered before because class attributes are mostly meant for configuration, so not really expected to be changed at runtime, but it can happen. This is 10 to 17x faster to assign a class attributes: ``` interpreter: old: 1834149.6 i/s new: 17722346.6 i/s - 9.66x faster yjit: old: 2561173.8 i/s new: 43004422.5 i/s - 16.79x faster ``` The difference is even bigger if something is redefining `method_added` events, e.g. sorbet... All other cases are unchanged in performance, except definition that is marginally faster. One downside however is that generated accessors source location will no longer point to the `class_attribute` callsite. |
||
---|---|---|
.. | ||
bin | ||
lib | ||
test | ||
.gitignore | ||
CHANGELOG.md | ||
MIT-LICENSE | ||
README.rdoc | ||
Rakefile | ||
activesupport.gemspec |
README.rdoc
= 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://guides.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