jcrist · GitHub

@jcrist

Previously we always normalized all timezones to UTC when decoding
datetime objects. This was for efficiency reasons, as it let us avoid
allocating a new `timezone` object on every decode.
However, some code makes use of the actual offset value - normalizing
datetimes to UTC loses this information.
This PR removes the timezone normalization; datetimes will now decode
into the specified timezone. We also keep a small cache of timezone
objects around indexed by their offset. This should help us avoid
allocating timezone objects in a hot loop; the assumption being messages
containing multiple datetime objects probably all share the same
timezone. The timezone cache has the same cache-clearing rules as the
string cache (currently cleared every 10 full GC cycles).

Read the original on github.com ↗