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

Really? Has to be pretty big script to take more than a few millisec. For linux, there's a tool bundled with sources (linux/tools/perf). Far more precise and informational.
$ perf stat perl -c -e1
-e syntax OK

 Performance counter stats for 'perl -c -e1':

          1.188739 task-clock                #    0.792 CPUs utilized          
                 2 context-switches          #    0.002 M/sec                  
                 0 CPU-migrations            #    0.000 K/sec                  
               447 page-faults               #    0.376 M/sec                  
           3499769 cycles                    #    2.944 GHz                    
           2156006 stalled-cycles-frontend   #   61.60% frontend cycles idle   
           1317972 stalled-cycles-backend    #   37.66% backend  cycles idle   
           2415287 instructions              #    0.69  insns per cycle        
                                             #    0.89  stalled cycles per insn
            488421 branches                  #  410.873 M/sec                  
             24245 branch-misses             #    4.96% of all branches        

       0.001500676 seconds time elapsed
  • Comment on Re^2: How can one best measure compile time of their Perl script?

Replies are listed 'Best First'.
Re^3: How can one best measure compile time of their Perl script?
by tobyink (Canon) on Nov 30, 2013 at 17:55 UTC

    "Really? Has to be pretty big script to take more than a few millisec."

    This one-liner seems to take more than a few milliseconds:

    time perl -c -e'use Moose; 1;'
    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
Re^3: How can one best measure compile time of their Perl script?
by taint (Chaplain) on Nov 30, 2013 at 19:31 UTC
    Thanks, oiskuu.

    Nice output. While I do have stat, and lstat for that matter, and of course, perl. I don't have perf -- at least not by name. Probably have something by another name (I'm using *BSD).

    Which means, for the sake of portability, I should use something derived from Perl itself. Though
    perl -c
    seems to provide some interesting statistics. :)

    Thanks for the informative response, oiskuu.

    --Chris

    #!/usr/bin/perl -Tw
    use Perl::Always or die;
    my $perl_version = (5.12.5);
    print $perl_version;