|
![](/i/fill.gif) |
On 13/01/2014 09:36 PM, Francois Labreque wrote:
> Le 2014-01-12 05:38, Orchid Win7 v1 a écrit :
>>
>> I don't have the book in front of me now, but prime number sieving is
>> actually one of the examples. They even go so far as to remove the "stop
>> searching after sqrt(max)" optimisation to "make the code simpler".
>> Because most of the time, being able to understand the code is far more
>> important than getting maximum performance out of it.
>
> If you do leave it in, *that* is worthy of a comment. Not every
> programmer will be good enough with math to figure out why you don't
> need to check for factors > sqrt(max).
I agree. That's the sort of thing that's sufficiently non-obvious that
it ought to be explained somewhere.
Then again, how many programs sieve prime numbers? Most software seems
to just push database records from A to B and back again...
Post a reply to this message
|
![](/i/fill.gif) |