[Haskell-cafe] Differences in optimisiation with interactive and compiled mo

Branimir Maksimovic bmaxa at hotmail.com
Sat Dec 10 19:42:04 EST 2005




>From: Daniel Fischer <daniel.is.fischer at web.de>
>To: "Branimir Maksimovic" <bmaxa at hotmail.com>
>CC: Haskell-Cafe at haskell.org
>Subject: Re: [Haskell-cafe] Differences in optimisiation with interactive 
>and compiled mo
>Date: Sat, 10 Dec 2005 23:56:28 +0100
>
>Am Samstag, 10. Dezember 2005 18:29 schrieb Branimir Maksimovic:
> > From: Tomasz Zielonka <tomasz.zielonka at gmail.com>
> >
> > >To: Branimir Maksimovic <bmaxa at hotmail.com>
> > >CC: lemming at henning-thielemann.de, haskell-cafe at haskell.org
> > >Subject: Re: [Haskell-cafe] Differences in optimisiation with 
>interactive
> > >and compiled mo
> > >Date: Sat, 10 Dec 2005 18:14:58 +0100
> > >
> > >On Sat, Dec 10, 2005 at 04:14:20PM +0000, Branimir Maksimovic wrote:
> > > > Nice code.
> > >
> > >But incorrect. I have broken it when refactoring :-/
> > >
> > >Here is the correct version:
> > >
> > >replace2 src dst = repl
> > >   where
> > >     repl input | src `isPrefixOf` input = dst ++ repl (drop (length 
>src)
> > >input)
> > >     repl (x:xs) = x : repl xs
> > >     repl [] = []
> > >
> > > > But it takes lot of ram (1GB is not enough )and can't execute my 
>test.
> > >
> > >Can you check this version?
> >
> > It's ok now; 2 megs like other versions.
> > It's just about 1.5 seconds slower then mine version and Daniels version 
>is
> > a
> > bit faster the mine.
> >
> > bmaxa at MAXA ~/tutorial
> > $ time ./replace1.exe
> > Working:seaseasearch replace  able seaseaseasearch baker seaseasearch
> > charlie
> > True
> > Done
> >
> >
> > real    0m14.140s
> > user    0m0.015s
> > sys     0m0.000s
> >
> > Greetings, Bane.
> >
>On my thingy, Tomasz' version is a bit faster than my version of the same
>algorithm for seasea..., and a bit slower for rrrrrrrrrrrrrrrr... and this
>algorithm is definitely the fastest submitted. Odd that your timings are
>different (in order) -- maybe it's something about Linux vs. Windows?
>

Well, I have same results on linux , though I just compared two versions.
I think that it because I uise -O2 flag. mine version does benefit
with it (perhaps less temporaries and more inlines? )
What's the difference between -O2 and -O because I see noticable difference
with my version?

Greetings, Bane.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



More information about the Haskell-Cafe mailing list