in reply to How can one best measure compile time of their Perl script?

The problem with the Unix time command is that it is not very reliable for very short processes:

$ time perl -c -e'use posix; 1;' -e syntax OK real 0m0.211s user 0m0.015s sys 0m0.077s ~ $ time perl -c -e'use posix; 1;' -e syntax OK real 0m0.093s user 0m0.015s sys 0m0.077s

Replies are listed 'Best First'.
Re^2: How can one best measure compile time of their Perl script?
by taint (Chaplain) on Nov 30, 2013 at 20:03 UTC
    Interesting results, Laurent_R.

    Could it have anything to do with the scheduler (not sure Linux has that by name). But perhaps the Process Scheduler will be an issue regardless, and throw differing times. No matter what the size of the script.

    So, in the end. One can only count on an average. Not a precise result

    --Chris

    #!/usr/bin/perl -Tw
    use Perl::Always or die;
    my $perl_version = (5.12.5);
    print $perl_version;
      There may be some scheduling delay, indeed. Another possibility is the result of OS caching. It seems to take a longer time the first time you try it, and then varying, but smaller times, on the next runs. For example, on the above command, all the subsequent runs lasted between 0.080 and 0.120 second, only the first one was significantly longer. Then, there is of course the effect of other processes running on the platform, but in the case above, I was the only user on the box, and not running anything else significant at the same time.