in reply to Re^2: Your favorite objects NOT of the hashref phylum
in thread Your favorite objects NOT of the hashref phylum

I remember using date in a log function once as a Perl junior. I finally noticed it because my code was taking a while to run, so I did my first ever profiling run on it. The backtick date was consuming 60% of the CPU time for the entire process.
  • Comment on Re^3: Your favorite objects NOT of the hashref phylum

Replies are listed 'Best First'.
Re^4: Your favorite objects NOT of the hashref phylum
by codeacrobat (Chaplain) on Mar 26, 2006 at 10:31 UTC
    It looks like it is more than 60% (cygwin, samsung x25). It does not matter whether you use backticks or a regular open to the date program, both are equally slow.
    $ time perl -e 'do {open PROGRAM, "date +%s|" or die "can not open dat +e $!";$time = <PROGRAM>;close PROGRAM} for 0 .. 1000' real 0m14.733s user 0m32.927s sys 0m9.109s $ time perl -e 'do { $time = `date +%s`} for 0 .. 1000' real 0m14.717s user 0m32.929s sys 0m9.138s $ time perl -e 'do { $time = time} for 0 .. 1000' real 0m0.084s user 0m0.061s sys 0m0.046s