mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
0adcec4954
The extra delegation to `LazyAttributeHash` has non-negligible overhead. Avoiding that delegation makes attributes access about 45% faster for readonly (non-mutation) usage. https://gist.github.com/kamipo/4002c96a02859d8fe6503e26d7be4ad8 Before: ``` IPS Warming up -------------------------------------- attribute access 1.000 i/100ms Calculating ------------------------------------- attribute access 3.444 (± 0.0%) i/s - 18.000 in 5.259030s MEMORY Calculating ------------------------------------- attribute access 38.902M memsize ( 0.000 retained) 350.044k objects ( 0.000 retained) 15.000 strings ( 0.000 retained) ``` After (with `immutable_strings_by_default = true`): ``` IPS Warming up -------------------------------------- attribute access 1.000 i/100ms Calculating ------------------------------------- attribute access 5.066 (±19.7%) i/s - 25.000 in 5.024650s MEMORY Calculating ------------------------------------- attribute access 27.382M memsize ( 0.000 retained) 160.044k objects ( 0.000 retained) 15.000 strings ( 0.000 retained) ``` |
||
---|---|---|
.. | ||
attribute | ||
attribute_set | ||
locale | ||
serializers | ||
type | ||
validations | ||
attribute.rb | ||
attribute_assignment.rb | ||
attribute_methods.rb | ||
attribute_mutation_tracker.rb | ||
attribute_set.rb | ||
attributes.rb | ||
callbacks.rb | ||
conversion.rb | ||
dirty.rb | ||
error.rb | ||
errors.rb | ||
forbidden_attributes_protection.rb | ||
gem_version.rb | ||
lint.rb | ||
model.rb | ||
naming.rb | ||
nested_error.rb | ||
railtie.rb | ||
secure_password.rb | ||
serialization.rb | ||
translation.rb | ||
type.rb | ||
validations.rb | ||
validator.rb | ||
version.rb |