Am Mittwoch, 1. August 2007 22:54 schrieb ChrisK:
My optimized (and fixed) version of the code is attached.
I adapted my KMP implementation from one and a half years ago to the problem
at hand (no longer search and replace, only find index of first match, and
change from Strings to
Oooops, stupid error before, fixed below.
Missed it due to too few and simple tests, should've quickchecked :-/
Cheers,
Daniel
-- KMP algorithm for lazy ByteStrings
{-# OPTIONS_GHC -fbang-patterns #-}
module KMP (kmpMatch) where
import qualified Data.Array.Base as Base (unsafeAt)
import
Justin Bailey wrote:
On 7/31/07, Donald Bruce Stewart [EMAIL PROTECTED] wrote:
jgbailey:
Also, be sure to compare against a naive search, optimised for
strict and lazy bytestrings,
http://hpaste.org/1803
If its not faster than those 2, then you're doing something wrong :)
-- Don
I am still working on improving your code.
And I have a Is this a bug? question:
The lookup = computeLookup pat defines lookup to take an Int which represents
the index into pat, where this index is 0 based and the 0th item is the head of
pat.
Now look at matchLength :: Int; matchLength = let
My optimized (and fixed) version of the code is attached. I benchmarked it
with:
module Main(main) where
import KMPSeq
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString.Lazy.Char8 as BC
infile = endo.dna
Modified by one character from the original copied from
G'day all.
Quoting ChrisK [EMAIL PROTECTED]:
My optimized (and fixed) version of the code is attached.
By the way. I don't know if this is relevant, but I'm curious if this
approach is any faster:
http://72.14.253.104/search?q=cache:kG4zvvkZPLYJ:www.haskell.org/hawiki/RunTimeCompilation
I