|Don't ask to ask, just ask|
Re(2): Lesson Taughtby shotgunefx (Parson)
|on Feb 23, 2003 at 01:30 UTC||Need Help??|
While I didn't bother to bench the C and Java versions, I can tell you there are many ways to speed this up.
Changing $i to a lexical gives you 10% more speed.
By using the pragma use integer in a lexically scoped block around the code you get 310% more speed.
It may not be a perfect number as I didn't not run the Java and C code, and there may be differences in implementation between my system and yours, but that would bring Perl down to 8 seconds which is a negligible difference.
More importantly, runtime is only a fraction of what matters in a real software project so comparing numbers like this is a really just mental wanking. And the fact that you go to a perl site to do it just says to me that your instigating which is pretty dumb. Would you go to an ethnic neighborhood and start slandering the locals? Not if you weren't looking for trouble.
"To be civilized is to deny one's nature."