[Haskell-cafe] ACM Task for C++ and Java programmers in Haskell. How to make code faster?

wren ng thornton wren at freegeek.org
Sun Mar 22 19:37:04 EDT 2009

Vasyl Pasternak wrote:
> The entire code I placed on
> Could someone help me to make this code faster? I'd like to see
> solution that will be elegant and fast, without heavy optimizations,
> that will make code unreadable. Also, if it possible, prepare the
> program to support SMP parallelism.

The solution's already been posted, but to make this particular code
faster, I recommend using Data.Trie instead of Data.Map ByteString. Tries
are faster for lookup since they don't redundantly check the prefix of the
query; also they're better for memory usage because they don't store
redundant copies of the prefixes.


Live well,

More information about the Haskell-Cafe mailing list