![]() |
|
Just another Perl shrine | |
PerlMonks |
Re: Re: Help w/ Code Optimizationby John M. Dlugosz (Monsignor) |
on Dec 27, 2001 at 02:08 UTC ( #134493=note: print w/replies, xml ) | Need Help?? |
Once upon a time, that was a good idea for PC's. On a 80486, where shift took 1 clock and multiply took up to 40, it was still faster sometimes. Note I said "up to" because it stops early, and essentially does this same thing internally--one addition for each '1' bit, using a barrel shifter that skips the zeros. But with Pentium and later, the multiply is just as fast as anything else, and breaking it up into multiple steps makes it slower, by far. —John
In Section
Seekers of Perl Wisdom
|
|