note
dragonchild
It's not.
<code>
use Benchmark qw( cmpthese );
my $large_number = 3 * 1234647389;
cmpthese( -1, {
modulo => sub { $large_number % 3 == 0 },
divide => sub { my $v; $v += $_ for split //, $large_number; $v % 3 == 0},
});
--------
Rate divide modulo
divide 30919/s -- -99%
modulo 2120579/s 6759% --
</code>
<p>By a factor of 67 times faster. Or so ...
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-85580">
<p align="center"><i><font size="-2">Being right, does not endow the right to be rude; politeness costs nothing.<br>Being unknowing, is not the same as being stupid.<br>Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.<br>Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.</font></i></p>
</div></div>
430254
430888