in reply to Re^3: 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?

Good catch.
#!/usr/bin/perl use integer; my $i = 0; while ($i += 20) { last unless ( $i % 19 or $i % 18 or $i % 17 or $i % 16 or $i % 15 or $i % 14 or $i % 13 or $i % 12 or $i % 11 ); } print "Number: $i\n";
Is 17% faster than my original version.
  • Comment on Re^4: Why is this code so much slower than the same algorithm in C?
  • Download Code