Optimizing Haskell code

前端 未结 6 1251
轮回少年
轮回少年 2020-12-31 04:20

I\'m trying to learn Haskell and after an article in reddit about Markov text chains, I decided to implement Markov text generation first in Python and now in Haskell. Howev

6条回答
  •  星月不相逢
    2020-12-31 05:13

    a) How are you compiling it? (ghc -O2 ?)

    b) Which version of GHC?

    c) Data.Map is pretty efficient, but you can be tricked into lazy updates -- use insertWith' , not insertWithKey.

    d) Don't convert bytestrings to String. Keep them as bytestrings, and store those in the Map

提交回复
热议问题