Closed nobu closed 5 years ago
I finally got around to this. I like your idea of simply removing @rules
. To avoid the performance hit I'm storing the rules in a local variable when I need them, and I have improved the performance of Loader::load
so that it only uses a single Hash
lookup.
Abstract
Marshal.dump
edTimezone::Zone
object contains cached@rules
. It doesn't feel preferable and intended.Example
Just created
Timezone
:After using the rules once:
Solutions
I'm thinking of a few ways.
define
_dump
ormarshal_dump
method.This is simple, but has a backward incompatibility.
remove
@rules
totallyRemove the assignment to the variable and call
Loader.load
always, inTimezone::Zone#private_rules
. It is just a cache, and alsoTimezone::Loader
does.This doesn't have no incompatibility perhaps, but may have a (very) little overhead.
move
@rules
toTimezone
module's instance variableSimilar to the previous one, but keep the 2-layer caches.
do not mind
It's just several KB :P