[Shootout-list] Re: ring of processes
Tomasz Zielonka
t.zielonka@students.mimuw.edu.pl
Sun, 3 Oct 2004 18:38:32 +0200
On Sun, Oct 03, 2004 at 03:08:49AM +0000, Aaron Denney wrote:
> Another possibility given the large heap usage is garbage-generation &
> collection. Not quite sure what to do about that, though there's a
> chance strictness annotations could help.
Using a different implementation of 'for' allows to decrease the number
of allocations and improves time by a factor of about 2.
for :: Int -> IO () -> IO ()
for n x = sequence_ [x | i <- [1..n]]
( Thanks to Carsten Schultz for pointing a 'for' implementation that GHC
handles so well )
Adding these RTS options also improves time
+RTS -A8m -k256
BTW, -k128 makes things worse, probably bacause the initial thread stack
is too small and has to be resized.
Best regards,
Tom
--
.signature: Too many levels of symbolic links