If you are comparing language execution speed {
  You may want to try the original perl line I submitted in order to get a 
more  effective comparison (or perhaps my original one but with 
shortcircuiting).  Alan's fixes certainly speed things up - but the "-a" 
invokes lower level parsing of the STDIN (basically a cheat) and the "-p" 
allows for not calling the standard print library which also may end up 
bypassing code which might be a speed reduction.

Actually after testing I see that I am just plain wrong.  The command line 
switches only serve to 
rewrite the code as the following shows:

[EMAIL PROTECTED] lib]$ perl -MO=Deparse -e '$t=1'
$t = 1;
-e syntax OK

[EMAIL PROTECTED] lib]$ perl -MO=Deparse -ape '$t=1'
LINE: while (defined($_ = <ARGV>)) {
    our(@F) = split(" ", $_, 0);
    $t = 1;
}
continue {
    print $_;
}
-e syntax OK

The "-ap" switches really do just put wrappers around the existing code.

Either way - in these cases, it may be good for Josh to specify a little more 
if the solutions must perform the reading of the input and the writing of 
output using standard language functions or libraries - not commandline 
switches.
 
} else if you just want to test raw speed of the fastest example {
  Use Alan's fixes.  They are awesome shortcuts and speedups.

}

Paul

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to