in reply to How to measure compilation time?

no idea, but *lima1 wonders if he would make a serious mistake in just measuring
sub { system('perl -c ' . shift) }
with the Benchmark module*

UPDATE: I thought you want to optimize compile time.

Replies are listed 'Best First'.
Re^2: How to measure compilation time?
by xdg (Monsignor) on Jul 11, 2006 at 19:06 UTC

    That would work if I really wanted to establish it definitively over many iterations, but it also winds up including the system dispatch and perl's own startup time, which may or may not be relevant for a particular use-case.

    In this instance, I actually wanted it more in passing as I compile and run things during testing.

    As a side note, it's probably a bit more robust across platforms to do this:

    system( $^X, '-c', shift )

    Even more robust would be to use Probe::Perl instead of $^X.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re^2: How to measure compilation time?
by diotalevi (Canon) on Jul 11, 2006 at 19:06 UTC

    Yes. You're also including a shell process and a new interpreter.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      You're also including a shell process
      Actually, you aren't, because the command does not contain shell meta characters (compare perldoc -f system). However I agree to xdg that the more-than-one-argument form of system would be better.