Ryan Dickie wrote:
One thing I've noticed is that turning on optimizations significantly
increases the speed of haskell code. Are you comparing code between
languages with -O2 or without opts?
I had done no optimization, but neither -O nor -O2 make a significant
difference in either the C or
For the purposes of learning, I am trying to optimize some variation of
the following code for computing all perfect numbers less than 1.
divisors i = [j | j-[1..i-1], i `mod` j == 0]
main = print [i | i-[1..1], i == sum (divisors i)]
I know this is mathematically stupid, but the point
On 10/28/07, Prabhakar Ragde [EMAIL PROTECTED] wrote:
For the purposes of learning, I am trying to optimize some variation of
the following code for computing all perfect numbers less than 1.
divisors i = [j | j-[1..i-1], i `mod` j == 0]
main = print [i | i-[1..1], i == sum (divisors
Jaak Randmets wrote:
On 10/28/07, Prabhakar Ragde [EMAIL PROTECTED] wrote:
For the purposes of learning, I am trying to optimize some variation of
the following code for computing all perfect numbers less than 1.
divisors i = [j | j-[1..i-1], i `mod` j == 0]
main = print [i | i-[1..1],
Prabhakar Ragde writes:
For the purposes of learning, I am trying to optimize some variation of
the following code for computing all perfect numbers less than 1.
divisors i = [j | j-[1..i-1], i `mod` j == 0]
main = print [i | i-[1..1], i == sum (divisors i)]
I know this is
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
Prabhakar Ragde wrote:
You could try giving divisors type signature:
divisors :: Int - [Int]
Thank you. That brings the time down to 0.5 seconds. I'm glad it was
something as simple as that. --PR
I assume GHC was smart enough to do inlining and such in this case, so
the difference is that
Stefan O'Rear adds to the dialogue:
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.
On Sun, 2007-10-28 at 10:23 -0400, Prabhakar Ragde wrote:
Jaak Randmets wrote:
On 10/28/07, Prabhakar Ragde [EMAIL PROTECTED] wrote:
For the purposes of learning, I am trying to optimize some variation of
the following code for computing all perfect numbers less than 1.
divisors i =
jerzy.karczmarczuk:
Stefan O'Rear adds to the dialogue:
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
On Sun, 2007-10-28 at 12:01 -0700, Don Stewart wrote:
jerzy.karczmarczuk:
Stefan O'Rear adds to the dialogue:
Prabhakar Ragde wrote:
Jerzy Karczmarczuk wrote:
Just a trivial comment... 1. Don't speak about comparing *languages*
when you compare *algorithms*,
and in
Am Sonntag, 28. Oktober 2007 20:09 schrieb Derek Elkins:
snip
That fits with my experience writing low level numeric code -- Integer
can be a killer.
Inline machine operations v. out-of-line calls to an arbitrary precision
integer C library: there shouldn't be any surprise here.
Hi,
Prabhakar Ragde wrote:
divisors i = [j | j-[1..i-1], i `mod` j == 0]
main = print [i | i-[1..1], i == sum (divisors i)]
Jerzy Karczmarczuk wrote:
My point didn't concern that point. Haskell compiler cannot change an
algorithm using lists into something which deals with indexable
One thing I've noticed is that turning on optimizations significantly
increases the speed of haskell code. Are you comparing code between
languages with -O2 or without opts?
On 10/28/07, Prabhakar Ragde [EMAIL PROTECTED] wrote:
For the purposes of learning, I am trying to optimize some
On Sun, Oct 28, 2007 at 08:40:28PM +0100, Daniel Fischer wrote:
Am Sonntag, 28. Oktober 2007 20:09 schrieb Derek Elkins:
snip
That fits with my experience writing low level numeric code -- Integer
can be a killer.
Inline machine operations v. out-of-line calls to an arbitrary
G'day all.
Quoting Don Stewart [EMAIL PROTECTED]:
That fits with my experience writing low level numeric code -- Integer
can be a killer.
Mind you, if you're intending to work with large integers or rationals,
Integer is great! The bottleneck is almost always show.
Cheers,
Andrew Bromage
16 matches
Mail list logo