mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
b6828fc915
I've realized that `user.id` is 20% slower than `user.name` in the
benchmark (https://github.com/rails/rails/pull/35987#issuecomment-483882480).
The reason that performance difference is that `self.class.primary_key`
method call is a bit slow.
Avoiding that method call will make almost attribute access faster and
`user.id` will be completely the same performance with `user.name`.
Before (
|
||
---|---|---|
.. | ||
optimistic.rb | ||
pessimistic.rb |