[Haskell-beginners] Performance of Idiomatic lazy Haskell

Daniel Fischer daniel.is.fischer at web.de
Mon Feb 1 09:40:52 EST 2010


Am Montag 01 Februar 2010 15:22:45 schrieb Markus Böhm:

> Daniel, I use GHC 6.12.1 and Windows XP.

*sigh*

Have you a CygWin installed? It should run as given from a CygWin shell, I 
believe.

> The time command doesn't seem
> to work. It says in German: specified time can't be read. Give a new
> time.

Replace "time" with however you get the CPU time used by a process on 
Windows.
But I think Windows doesn't allow piping, and I'm not sure whether it has 
echo, so see below.

> Daniel, here another feedback:
>
> F:\MeineUebungen>ghc -O2 -fexcess-precision -fvia-C -optc-O3 -o luaLoop
> --make p 085-pi_lualoop.hs
> [1 of 1] Compiling Main             ( p085-pi_lualoop.hs,
> p085-pi_lualoop.o ) Linking luaLoop.exe ...
>
> F:\MeineUebungen>echo '0.00000001' | time ./luaLoop
> Eingegebene Zeit kann nicht übernommen werden.
> Geben Sie die neue Zeit ein:
>
> F:\MeineUebungen>luaLoop +RTS -sstderr -RTS
> luaLoop +RTS -sstderr
> EPS:
> 0.00000001
> 3.1415926485894725
>           61,428 bytes allocated in the heap
>            1,316 bytes copied during GC
>            4,564 bytes maximum residency (1 sample(s))
>           11,820 bytes maximum slop
>                1 MB total memory in use (0 MB lost due to fragmentation)
>
>   Generation 0:     0 collections,     0 parallel,  0.00s,  0.00s
> elapsed Generation 1:     1 collections,     0 parallel,  0.00s,  0.00s
> elapsed
>
>   INIT  time    0.02s  (  0.00s elapsed)
>   MUT   time    8.06s  ( 16.83s elapsed)
>   GC    time    0.00s  (  0.00s elapsed)
>   EXIT  time    0.00s  (  0.00s elapsed)
>   Total time    8.08s  ( 16.83s elapsed)
>
>   %GC time       0.0%  (0.0% elapsed)
>
>   Alloc rate    7,604 bytes per MUT second
>
>   Productivity  99.8% of total user, 47.9% of total elapsed

What?????

Please try the following:

1) hardcode eps = 1e-8 in the source (or get it via getArgs and pass it as 
a command line argument)
2) ghc -O2 -fforce-recomp -fexcess-precision -fvia-C -optc-O3 -o cloop --
make Source.hs
3) ghc -O2 -fforce-recomp -o nloop --make Source.hs
4) cloop +RTS -sstderr
5) nloop +RTS -sstderr

>
> -- Markus
>


More information about the Beginners mailing list