http://www.perlmonks.org?node_id=729101


in reply to Re: Why is this code so much slower than the same algorithm in C?
in thread Why is this code so much slower than the same algorithm in C?

and you are not allowed to put it in a batch or shell script, because that is part of another language

What? Well, OK, since it's pretty tough to automate compilation and execution without some sort of "script", the following example takes my corrected typing speed into account, too!

pts/0 $> date Mon Dec 8 23:40:17 PST 2008 pts/0 $> gcc p5.c pts/0 $> ./s.^H^Ha.out Number: 232792560 pts/0 $> date Mon Dec 8 23:40:21 PST 2008

Still less than four seconds, and most of that was thanks to my clumsy typing. Fair enough, no?

Anyway, compile time is irrelevant for a bunch of reasons, but mainly: compile time will be negligible for any CPU-bound problem of significant size. Such problems are more or less the point of this node.

Finally, to really look at the compilation step fairly, how many real-world programs (including real-world Perl programs) really need to be recompiled every time they are run? For many applications, an "interpreted" compilation step is just another nail in the comparative performance coffin.