On 2/28/05 1:26 PM, Dave Rolsky wrote:
> On Mon, 28 Feb 2005, Geoffrey Young wrote:
>>> The hugeness is the DateTime::TimeZone object, not DateTime itself.
>>> Those are all singletons, so you only pay the price once per time zone.
>>
>> ok, but how does that affect storable-style serializations? I noticed that
>> you have some storable hooks, but I didn't see exactly how it worked.
>
> Unfortunately, it's not possible to retain singleton-ness after a
> freeze/thaw with Storable. This is because of the way Storable's
> internals work. I _think_ this could be changed, and I tried doing so,
> but couldn't quite figure it out. I brought it up on P5P a while back
> (maybe a year) but nobody responded.
Can't you just nuke the giant DT:TZ ref before freezing and have it
auto-re-vivify when first used after it's thawed? IOW, save the TZ string
("floating", "local", "America/Chicago") and then re-grab a ref to the
DT::TZ singleton as needed. That way, you don't have to freeze the DT::TZ
at all.
Of course, I don't know how flexible the Storable hooks are...
-John