> And this could be sped up. Move making the duration object out of the > sub, and make it like this:
I was trying to be fair and not preserve information between runs. Of course in the real world... > my $dt_dur = DateTime::Duration->new( days => -4 ); > > and inside the sub call add_duration instead. I didn't even consider this one. Maybe something like this should be added to the docs? -- diff -ur DateTime-0.08/lib/DateTime.pm new.DateTime/lib/DateTime.pm --- DateTime-0.08/lib/DateTime.pm 2003-03-20 20:02:27.000000000 -1000 +++ new.DateTime/lib/DateTime.pm 2003-03-24 21:43:32.000000000 -1000 @@ -1347,7 +1347,8 @@ When given a C<DateTime::Duration> object, this method simply calls C<invert()> on that object and passes that new duration to the -C<add_duration> method. +C<add_duration> method. It is an optimization to to add a negative +duration rather than to subtract a positive one. =item * subtract( DateTime::Duration->new parameters ) -- > Nonetheless, it'd still be nice to go faster ;) Until you get a ticket and your insurance rates go up. :) I got a ticket last Friday. -J --
