On 7/5/05 11:09 PM, Rick Measham wrote: > I have written a module I tentatively call DateTime::Diet that helps > with this. I use DateTime in all sort of projects including hooks in > Class::DBI where many many table records all become DateTime objects, > even if I don't need the column that represents a DateTime.
After bumping into the cost (CPU and memory) of creating DateTime objects for each date-like column in a database row, my solution was to have my OO/DB mapper module defer the "inflation" process until I actually ask for a DateTime object. I'm not using Class::DBI, but I believe it has a similar ability (although I'm not sure if it can "round-trip" from and back into the database without any inflation). Anyway, just chalk this up to another example of working around the overhead of creating many, many DateTime objects. I looked at speeding up DateTime->new a while ago (over a year I think) and a few things were done (by Dave, I think) to make it a lot faster, but I've stuck with my deferred inflation system because, as fast as new() gets, it's still faster to do nothing at all. -John