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

Hello,

It would be interesting to see how well the code performs under perl 5.8 and perl 5.6 as well.

Regards,

  • Comment on Re: Why is this code so much slower than the same algorithm in C?

Replies are listed 'Best First'.
Re^2: Why is this code so much slower than the same algorithm in C?
by wanna_code_perl (Friar) on Dec 09, 2008 at 05:02 UTC

    Apples to oranges, but ActiveState 5.8.8 (Windows) on a significantly faster dual-core machine: 28 seconds.

    Unfortunately, I no longer have any good way to run 5.6.

      Apples to oranges...

      Well the script is a constant because all three perl binaries can run it unmodified. Actually, I found 5.6 runs much faster (not surprising, it is a much slimmer app). The top run is using a system provided 5.8, and the second run is a 5.6 install I have for an app I maintain:

      $ time /usr/bin/perl test.pl Number: 232792560 real 0m29.042s user 0m29.039s sys 0m0.004s $ time usr/bin/perl test.pl Number: 232792560 real 0m20.968s user 0m20.961s sys 0m0.006s

      I ran it a few times and the figures were about the same. But I agree, not really useful. It is a bit interesting though.

      Regards,