Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

vek (2312)

vek
  (email not shown publicly)

Journal of vek (2312)

Thursday March 07, 2002
01:06 AM

Time::Piece

[ #3339 ]

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...

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • FWIW, from Date/Manip.pod:

    The downside is that Date::Manip is slow, especially when compared to several of the other Date/Time modules which are written in C. Although I am working on making Date::Manip faster, it will never be as fast as these modules. And before anyone asks, Date::Manip will never be translated to C (at least by me). I write C because I have to. I write perl because I like to. Date::Manip is something I do because it interests me, not something I'm paid for. Yes, Date::Manip is

  • 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