[Haskell-cafe] newbie optimization question
Stefan O'Rear
stefanor at cox.net
Sun Oct 28 12:38:59 EDT 2007
On Sun, Oct 28, 2007 at 11:26:46AM -0400, Prabhakar Ragde wrote:
> Jerzy Karczmarczuk wrote:
>
>> Just a trivial comment... 1. Don't speak about comparing *languages* when
>> you compare *algorithms*,
>> and in particular data structures.
>> 2. Please, DO code the above in C, using linked lists. Compare then. 3.
>> Check the influence of bare printing, separated from the computation.
>
> Isn't GHC clever enough to optimize away the entire computation if there is
> no I/O?
Yes, but GHC is not clever enough to solve the perfect number
classification problem. 'length' will suffice, and is prefered for most
enumeration benchmarks.
Note, however, that there are a grand total of 4 perfect numbers less
than 10,000. Not exactly an IO problem.
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20071028/312109d5/attachment.bin
More information about the Haskell-Cafe
mailing list