diff options
author | Andrew White <andrew.white@unboxed.co> | 2016-10-02 17:15:44 +0100 |
---|---|---|
committer | Andrew White <andrew.white@unboxed.co> | 2016-10-02 17:15:44 +0100 |
commit | 9128ba5cd496eed89e14f92f7b3fdbed1bdf5750 (patch) | |
tree | 9683efa1f6d8aeb371704983bb48ef8ca07b2534 /activerecord/test | |
parent | bd8f0871c2791f30b644aeeec98da7cbb15b2168 (diff) | |
download | rails-9128ba5cd496eed89e14f92f7b3fdbed1bdf5750.tar.gz rails-9128ba5cd496eed89e14f92f7b3fdbed1bdf5750.tar.bz2 rails-9128ba5cd496eed89e14f92f7b3fdbed1bdf5750.zip |
Cache to_time to improve performance when comparing
In #25880 we tried to cache localtime to fix the performance
regression but that proved to be difficult due to the fact that
localtime/getlocal can take a utc_offset argument. We tried
caching based on the argument but since the argument can be nil
sometimes that meant that if the TZ environment variable changed
then the cached value for nil became invalid. By moving the
caching to DateAndTime#compatibility we don't have to worry about
arguments since it doesn't take any.
There is a possible edge condition where preserve_timezone is set
to false and the system timezone changes then it could result in
a cached value being incorrect but the only way to fix this would
be to remove all caching and live with the performance issue.
Diffstat (limited to 'activerecord/test')
0 files changed, 0 insertions, 0 deletions