>>>>> "UG" == Uri Guttman <u...@stemsystems.com> writes:
>>>>> "m" == matt <matthew.leonha...@gmail.com> writes: m> So...I've proved that in my specific environment, C is (~3x) faster m> than Perl at adding 1+1...Now as far as what tests you want to m> implement, that's up to you and your specific needs. UG> sorry, you haven't proved anything. and i forgot one more major overhead, process startup. in both cases you have a fork/exec in the bash loop which will swamp out a simple addition. addition in c should actually be 10 or more times faster than perl, not just 3 times. c would compile that to a few instructions, possibly as little as one or two based on the cpu and compiler. perl would have to execute several perl ops each of which is many cpu instructions. perl op loop is much slower than the actual ops in many cases. my point is that benchmarking is an art and requires real understanding of many coding issues. you have to be able to isolate the part you are comparing and filter out common stuff. you need to time it more accurately than just calling time from the shell. in fact the way to do what you attempted is to use the benchmark.pm module and inline C to write the c code inside the perl test program. then you wouldn't need the bash, the fork/exec and the other overhead. it still isn't a valid comparison of perl vs c speed since it tests such a simple op. you need more depth to the test for a legitimate comparison. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/