Cheers matts, saved me a code re-write. A former co-worker of mine wrote an in-house module years ago that does almost everything Time::Piece does. Except that it's sloooow, really slooow. I've been wanting to re-write the damn thing for ages, it uses Date::Manip which I think is the offending beast. I never got around to the re-write of course and faced the "opinions" of those higher up on the totem pole at work, yeh but our in-house module just works, if it aint broke don't fix it. So, tonight I wrote some benchmark code, just had both modules calc today's date in YYYYMMDD format (20000 iterations):
Benchmark: timing 20000 iterations of Time::Piece, DateAndTime.pm...
Time::Piece: 7 wallclock secs ( 6.68 usr + 0.39 sys = 7.07 CPU) @ 2828.85/s (n=20000)
DateAndTime.pm: 168 wallclock secs (162.68 usr 0.03 sys + 0.00 cusr 0.02 csys = 162.73 CPU) @ 122.92/s (n=20000)
'kay, I think I'll use Time::Piece thanks...
Date::Manip (Score:1)
Time::Piece is my favorite module (Score:2)
A design for something identical to this module was etched in red on my whiteboard for the first six months of 2000. (After Dec. 31, 1999 when I fixed a bunch of contract code that was supposed to have been reviewed, and then spent Jan. 3 reviewing it and thinking. Am I the only person who actually read the docs to localtime() the first time he used it?) Of course, I had no time to actually implement the thing. Then one day Time::Object appeared. I was amazed; it was as if Matt had read my mind. (And
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers