[Haskell-cafe] Substring replacements

Branimir Maksimovic bmaxa at hotmail.com
Mon Dec 12 07:19:03 EST 2005




>From: Daniel Fischer <daniel.is.fischer at web.de>
>To: sylvan at student.chalmers.se
>CC: Haskell-Cafe at haskell.org
>Subject: Re: [Haskell-cafe] Substring replacements
>Date: Mon, 12 Dec 2005 10:31:49 +0100
>
>Am Montag, 12. Dezember 2005 01:34 schrieben Sie:
> > On 12/12/05, Daniel Fischer <daniel.is.fischer at web.de> wrote:
> > > Okay, I have looked up KMP and implemented it.
> > > Seems to work -- my first use of QuickCheck, too.
> > > It's slower than Bulat's and Tomasz' for Branimir's test :-(,
> > > but really fast for my test.
> > > Undoubtedly, one can still tune it.
> >
> > Perhaps by using unboxed arrays...
> >
> > /S
> >
> >
> > --
> > Sebastian Sylvan
> > +46(0)736-818655
> > UIN: 44640862
>
>I'm afraid, unboxed arrays are out of the question, because bord is
>incrementally produced :-(
>
>
>Working very long
>test2: <<loop>>
>

No worrie your test is now fastest with both your and mine test.
I;ve forgot to change working function in your test:0)

mine test: your program is  is srchrep.exe
bmaxa at MAXA ~/tutorial
$ time searchr.exe
Working:seasearch replace  able seaseasearch baker seasearch charlie
True
Done


real    0m14.344s
user    0m0.015s
sys     0m0.015s

bmaxa at MAXA ~/tutorial
$ time srchrep.exe
Working:seasearch replace  able seaseasearch baker seasearch charlie
True
Done


real    0m10.672s > your program is almost 1.5 secs faster then Bulat's
user    0m0.015s
sys     0m0.000s

bmaxa at MAXA ~/tutorial
$ time replace1.exe
Working:seasearch replace  able seaseasearch baker seasearch charlie
True
Done


real    0m12.016s
user    0m0.015s
sys     0m0.015s


now your test:

bmaxa at MAXA ~/tutorial
$ time searchr.exe
Working very long
True
Done

real    0m0.312s
user    0m0.015s
sys     0m0.015s

bmaxa at MAXA ~/tutorial
$ time replace1.exe
Working very long
False
Done

real    0m12.516s
user    0m0.015s
sys     0m0.015s

bmaxa at MAXA ~/tutorial
$ time srchrep.exe
Working very long
True
Done

real    0m0.375s > yours is less then second as mine but is fastest in both 
tests
user    0m0.015s
sys     0m0.015s

I don;t know how you get lesser numbers with mine test, but on
this machine your KMP algorithm performs best.


Greetings ,Bane.

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



More information about the Haskell-Cafe mailing list