[Haskell-beginners] Performance of Idiomatic lazy Haskell

Tim Perry perry2of5 at yahoo.com
Mon Feb 1 14:15:25 EST 2010

CygWin would be a good option.

Here are some other ideas:

There is a timeit.exe utility in the Windows Server downloads which is supposed to be similar to unix's time command. Try the links here

Windows does support piping. It is similar to bash with 2>&1 to redirect stderr to stdout and stuff.

The new windows shell is almost a real shell. Almost.

If you don't have that, then this port of unix utilities makes an XP box tolerable.

Hope that helps.

----- Original Message ----
From: Daniel Fischer <daniel.is.fischer at web.de>
To: Markus Böhm <markus.boehm at googlemail.com>
Cc: beginners at haskell.org
Sent: Mon, February 1, 2010 6:40:52 AM
Subject: Re: [Haskell-beginners] Performance of Idiomatic lazy Haskell

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

> Daniel, I use GHC 6.12.1 and Windows XP.


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

> 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 
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


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
Beginners mailing list
Beginners at haskell.org

More information about the Beginners mailing list