Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: Performance of Idiomatic lazy Haskell (Markus B?hm)
2. Re: Performance of Idiomatic lazy Haskell (Daniel Fischer)
3. Re: Performance of Idiomatic lazy Haskell (Tim Perry)
4. Re: foldr for Nats ([email protected])
5. Problems installing TagSoup.Parsec (Mark Wong-VanHaren)
----------------------------------------------------------------------
Message: 1
Date: Mon, 1 Feb 2010 15:59:59 +0100
From: Markus B?hm <[email protected]>
Subject: Re: [Haskell-beginners] Performance of Idiomatic lazy Haskell
To: Daniel Fischer <[email protected]>
Cc: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
1. I used Your lualoop file with content:
module Main (main) where
main :: IO ()
main = do
--putStrLn "EPS:"
-- eps <- readLn :: IO Double
print $ 4*calcPi 0.00000001
calcPi :: Double -> Double
calcPi eps = go False 1 3
where
go bl p1 i
| 4*abs(p2-p1) < eps = p1
| otherwise = go (not bl) p2 (i+2)
where
p2 | bl = p1+1/i
| otherwise = p1-1/i
2.
F:\MeineUebungen>ghc -O2 -fforce-recomp -fexcess-precision -fvia-C -optc-O3 -o c
loop --make p085-pi_lualoop.hs
[1 of 1] Compiling Main ( p085-pi_lualoop.hs, p085-pi_lualoop.o )
Linking cloop.exe ...
F:\MeineUebungen>ghc -O2 -fforce-recomp -o nloop --make p085-pi_lualoop.hs
[1 of 1] Compiling Main ( p085-pi_lualoop.hs, p085-pi_lualoop.o )
Linking nloop.exe ...
F:\MeineUebungen>cloop +RTS -sstderr
cloop +RTS -sstderr
3.1415926485894725
20,860 bytes allocated in the heap
892 bytes copied during GC
3,068 bytes maximum residency (1 sample(s))
13,316 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.02s elapsed)
MUT time 7.39s ( 7.27s elapsed)
GC time 0.00s ( 0.00s elapsed)
EXIT time 0.00s ( 0.00s elapsed)
Total time 7.41s ( 7.28s elapsed)
%GC time 0.0% (0.0% elapsed)
Alloc rate 2,816 bytes per MUT second
Productivity 99.8% of total user, 101.5% of total elapsed
F:\MeineUebungen>nloop +RTS -sstderr
nloop +RTS -sstderr
3.1415926485894725
20,860 bytes allocated in the heap
892 bytes copied during GC
3,068 bytes maximum residency (1 sample(s))
13,316 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 4.77s ( 4.81s elapsed)
GC time 0.00s ( 0.00s elapsed)
EXIT time 0.00s ( 0.00s elapsed)
Total time 4.78s ( 4.81s elapsed)
%GC time 0.0% (0.0% elapsed)
Alloc rate 4,362 bytes per MUT second
Productivity 99.7% of total user, 99.0% of total elapsed
-- Markus
On Mon, Feb 1, 2010 at 3:40 PM, Daniel Fischer <[email protected]> wrote:
> 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
>>
>
------------------------------
Message: 2
Date: Mon, 1 Feb 2010 17:10:46 +0100
From: Daniel Fischer <[email protected]>
Subject: Re: [Haskell-beginners] Performance of Idiomatic lazy Haskell
To: Markus B?hm <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Am Montag 01 Februar 2010 15:59:59 schrieb Markus Böhm:
> 1. I used Your lualoop file with content:
> module Main (main) where
>
> main :: IO ()
> main = do
> --putStrLn "EPS:"
> -- eps <- readLn :: IO Double
> print $ 4*calcPi 0.00000001
>
> calcPi :: Double -> Double
> calcPi eps = go False 1 3
> where
> go bl p1 i
>
> | 4*abs(p2-p1) < eps = p1
> | otherwise = go (not bl) p2 (i+2)
>
> where
> p2 | bl = p1+1/i
>
> | otherwise = p1-1/i
>
Oops, I've screwed up my timings earlier, that variant doesn't quite give
optimal speed (3.65s via-C vs.3.02s for the other loops, but the NCG code
of that takes a whopping 12.13s here vs. 4.x - 6.y s for the other loops),
what I had measured was
====================================
calcPi :: Double -> Double
calcPi eps = go False 1 3
where
go True p1 i
| 4*(p2-p1) < eps = p1
| otherwise = go False p2 (i+2)
where
p2 = p1+1/i
go False p1 i
| 4*(p1-p2) < eps = p1
| otherwise = go True p2 (i+2)
where
p2 = p1-1/i
====================================
(which gives 3.03s via C and 6.91s with the NCG). Mind trying that, too?
Nevertheless, the results are seriously disturbing.
The previous code runs more than 2.5 times as fast on your computer than on
mine when compiled with the NCG and twice as fast on my computer than on
yours when compiled via C.
I don't know what to make of it.
> 2.
> F:\MeineUebungen>ghc -O2 -fforce-recomp -fexcess-precision -fvia-C
> -optc-O3 -o c loop --make p085-pi_lualoop.hs
> [1 of 1] Compiling Main ( p085-pi_lualoop.hs,
> p085-pi_lualoop.o ) Linking cloop.exe ...
>
>
> F:\MeineUebungen>ghc -O2 -fforce-recomp -o nloop --make
> p085-pi_lualoop.hs [1 of 1] Compiling Main (
> p085-pi_lualoop.hs, p085-pi_lualoop.o ) Linking nloop.exe ...
>
> F:\MeineUebungen>cloop +RTS -sstderr
> cloop +RTS -sstderr
> 3.1415926485894725
> 20,860 bytes allocated in the heap
> 892 bytes copied during GC
> 3,068 bytes maximum residency (1 sample(s))
> 13,316 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.02s elapsed)
> MUT time 7.39s ( 7.27s elapsed)
> GC time 0.00s ( 0.00s elapsed)
> EXIT time 0.00s ( 0.00s elapsed)
> Total time 7.41s ( 7.28s elapsed)
>
> %GC time 0.0% (0.0% elapsed)
>
> Alloc rate 2,816 bytes per MUT second
>
> Productivity 99.8% of total user, 101.5% of total elapsed
>
>
> F:\MeineUebungen>nloop +RTS -sstderr
> nloop +RTS -sstderr
> 3.1415926485894725
> 20,860 bytes allocated in the heap
> 892 bytes copied during GC
> 3,068 bytes maximum residency (1 sample(s))
> 13,316 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 4.77s ( 4.81s elapsed)
> GC time 0.00s ( 0.00s elapsed)
> EXIT time 0.00s ( 0.00s elapsed)
> Total time 4.78s ( 4.81s elapsed)
>
> %GC time 0.0% (0.0% elapsed)
>
> Alloc rate 4,362 bytes per MUT second
>
> Productivity 99.7% of total user, 99.0% of total elapsed
>
>
> -- Markus
------------------------------
Message: 3
Date: Mon, 1 Feb 2010 11:15:25 -0800 (PST)
From: Tim Perry <[email protected]>
Subject: Re: [Haskell-beginners] Performance of Idiomatic lazy Haskell
To: Daniel Fischer <[email protected]>, Markus B?hm
<[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-1
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
http://channel9.msdn.com/forums/Coffeehouse/258979-Windows-equivalent-of-UnixLinux-time-command/
Windows does support piping. It is similar to bash with 2>&1 to redirect stderr
to stdout and stuff.
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true
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.
http://unxutils.sourceforge.net/
Hope that helps.
--Tim
----- Original Message ----
From: Daniel Fischer <[email protected]>
To: Markus Böhm <[email protected]>
Cc: [email protected]
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.
*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
>
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
------------------------------
Message: 4
Date: Mon, 01 Feb 2010 21:20:48 +0100
From: [email protected]
Subject: Re: [Haskell-beginners] foldr for Nats
To: Stephen Tetley <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
yeahh, I know that it is similar, but don't know how to start implementing it.
-------- Original-Nachricht --------
> Datum: Tue, 26 Jan 2010 11:05:20 +0000
> Von: Stephen Tetley <[email protected]>
> An:
> CC: [email protected]
> Betreff: Re: [Haskell-beginners] foldr for Nats
> Hi
>
> One hint is that your data type for natural numbers is remarkably like
> the data type for lists...
>
> data List a = [] | a : List a
>
> The difference is that List has an element of type 'a' at the non-zero
> cases.
>
> Best wishes
>
> Stephen
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
--
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser
------------------------------
Message: 5
Date: Mon, 1 Feb 2010 12:21:12 -0800
From: Mark Wong-VanHaren <[email protected]>
Subject: [Haskell-beginners] Problems installing TagSoup.Parsec
To: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Hi, folks-
I'm a Haskell newbie. There's a very real chance my question has a simple
answer.
I wish to use the library Text.HTML.TagSoup.Parsec (
http://hackage.haskell.org/package/tagsoup-parsec), which looks very cool.
When I attempt to install it, I get this error:
# cabal install tagsoup-parsec
Resolving dependencies...
Configuring tagsoup-parsec-0.0.6...
Preprocessing library tagsoup-parsec-0.0.6...
Building tagsoup-parsec-0.0.6...
[1 of 1] Compiling Text.HTML.TagSoup.Parsec ( Text/HTML/TagSoup/Parsec.hs,
dist/build/Text/HTML/TagSoup/Parsec.o )
Text/HTML/TagSoup/Parsec.hs:37:5:
`Tag' is not applied to enough type arguments
Expected kind `*', but `Tag' has kind `* -> *'
In the type synonym declaration for `WholeTag'
cabal: Error: some packages failed to install:
tagsoup-parsec-0.0.6 failed during the building phase. The exception was:
exit: ExitFailure 1
It would seem to be a type mismatch between TagSoup.Parsec and the base
TagSoup (on which it depends).
Suspecting that the version-number dependency information might be
incorrect, I tried uninstalling TagSoup and reinstalling an older version.
This didn't help.
Can anyone steer me in the right direction?
Thanks!
-Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://www.haskell.org/pipermail/beginners/attachments/20100201/bf84eb3e/attachment.html
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 20, Issue 3
****************************************