Fwd: [Haskell-cafe] Optimization fun

Peter Berry pwberry at gmail.com
Sat Feb 10 16:28:43 EST 2007


Gah! Gmail has really broken defaults for posting to lists.

On 10/02/07, Creighton Hogg <wchogg at gmail.com> wrote:
> Hello Haskell-ers,
> So a friend and I were thinking about making code faster in Haskell, and I
> was wondering if there was a way to improve the following method of
> generating the list of all prime numbers.  It takes about 13 seconds to run,
> meanwhile my friend's C version took 0.1.  I'd love to learn a bit more
> about how to optimize Haskell code.

Which subproblem takes 13 seconds? (Surely generating a list of all
primes will take an infinite amount of time, since there are
infinitely many of them?)

-- 
Peter Berry <pwberry at gmail.com>
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html


More information about the Haskell-Cafe mailing list