1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activemodel/test/cases
Ryuta Kamizono 0adcec4954 PERF: Avoid extra delegation to LazyAttributeHash
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)
```
2020-06-15 09:26:24 +09:00
..
serializers
type Don't call ruby2_keywords for user supplied block 2020-06-04 02:19:30 +09:00
validations Reject signed hexadecimal numbers while validating numericality 2020-04-22 12:15:57 +00:00
attribute_assignment_test.rb Change safe guard to check for each_pair instead of stringify_keys 2020-02-07 11:36:35 -05:00
attribute_methods_test.rb Fix warnings for attribute methods with kwargs 2020-01-21 00:34:06 +09:00
attribute_set_test.rb PERF: Avoid extra delegation to LazyAttributeHash 2020-06-15 09:26:24 +09:00
attribute_test.rb
attributes_dirty_test.rb Test clear_changes_information rather than reload 2019-10-21 10:52:54 +09:00
attributes_test.rb Attributes can be dup-ed 2020-05-06 00:40:48 +09:00
callbacks_test.rb
conversion_test.rb
dirty_test.rb Allow checking whether an attribute previously changed from/to a particular value 2020-01-27 16:38:24 -05:00
error_test.rb Fix i18n of attributes with multi-digit indexes 2019-10-17 10:23:00 -04:00
errors_test.rb No need to deprecate Errors#first 2020-04-13 19:07:59 -04:00
forbidden_attributes_protection_test.rb
helper.rb
lint_test.rb
model_test.rb
naming_test.rb
nested_error_test.rb
railtie_test.rb
secure_password_test.rb
serialization_test.rb
translation_test.rb
validations_test.rb