Subject: | Use DateTime::Tiny to cut the fat |
Hi,
Kristina mentioned at OSCON that DateTime was a bit of a pig and
dragging down MongoDB performance. DateTime::Tiny might help. It
creates a very light object which will turn itself into a real DateTime
object only when necessary. Simple methods and stringification will not
cause a DateTime object to be created.
It doesn't do validation on its arguments, so DateTime::Tiny->new( year
=> 2010, month => 32 ) will work where it won't work with DateTime. You
still have to depend on DateTime, DateTime::Tiny will only load it if
its available.
Unfortunately, DateTime::Tiny doesn't automatically upgrade to DateTime.
You currently have to tell it. I just submitted a patch to make it do
it automatically. See https://rt.cpan.org/Ticket/Display.html?id=59757
Hopefully it will be accepted. If not, you can take the AUTOLOAD, put
it into a DateTime::Tiny subclass and it will work.