On Dec 1, 8:58 pm, practicalp...@gmail.com wrote: > Hello, > > Maybe it's not so suitable to ask this here. > But is there a good way (code sample?) to implement a speed test > between Perl and C? > For a project which handles lots of data we want to know how slower > perl is than C. > > Thanks.
To perform the test, I'd just use 'time': test.cc: int main() { int a = 1 + 1; } test.pl: #!/sw/bin/perl $a = 1 + 1; # time bash -c 'for x in {1..100}; do ./a.out; done' real 0m0.167s user 0m0.029s sys 0m0.138s # time bash -c 'for x in {1..100}; do ./test2.pl; done' real 0m0.435s user 0m0.154s sys 0m0.247s So...I've proved that in my specific environment, C is (~3x) faster than Perl at adding 1+1...Now as far as what tests you want to implement, that's up to you and your specific needs. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/