We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I don't know your code, so I can't help you with that, but there are some hints I can give you:
Use recursion instead of IORefs/ST + Vector as
Haskell is optimised for recursion and but not for IORefs.
Make sure, that nothing is loaded into memory completely.
If you "consume" your strings instantly, the data will be streamed lazily from the console into your function which means less GC work.
Substring Searching
You are viewing a single comment's thread. Return to all comments →
I don't know your code, so I can't help you with that, but there are some hints I can give you:
Use recursion instead of IORefs/ST + Vector as Haskell is optimised for recursion and but not for IORefs.
Make sure, that nothing is loaded into memory completely. If you "consume" your strings instantly, the data will be streamed lazily from the console into your function which means less GC work.
Don't worry, I have these problems too sometimes!
Example:
Although being not the right algorithm, it fails only one test case.