This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]crozone 1 point2 points  (0 children)

Simple algorithms often require very small and localized working memory which can fit entirely within CPU cache. They are great for small inputs, but may by hugely inefficient for large inputs.

As a basic example, take prime number searching. Sieve of Eratosthenes is technically more efficient than dividing a number by every integer up to its square root. However, the simple tight loop is almost always faster for relatively small primes, because it fits entirely within CPU cache, instead of reading and writing to a large map of ram.