相关疑难解决方法(0)

GHC的垃圾收集RTS选项

我有一个Haskell程序,它处理一个文本文件并构建一个Map(有几百万个元素).整件事可以运行2-3分钟.我发现调整-H和-A选项会对运行时间产生很大影响.

有关于RTS的这个功能的文档,但是对我来说这是一个很难读的,因为我不知道GC理论的算法和术语.我正在寻找一个技术性较低的解释,最好是针对Haskell/GHC.是否有关于为这些选项选择合理值的参考?

编辑:这是代码,它为给定的单词列表构建一个trie.

buildTrie :: [B.ByteString] -> MyDFA 
buildTrie l = fst3 $ foldl' step (emptyDFA, B.empty, 1) $ sort $ map B.reverse l where
    step :: (MyDFA , B.ByteString, Int) -> B.ByteString -> (MyDFA , B.ByteString, Int)
    step (dfa, lastWord, newIndex) newWord = (insertNewStates, newWord, newIndex + B.length newSuffix) where            
        (pref, lastSuffix, newSuffix) = splitPrefix lastWord newWord
        branchPoint = transStar dfa pref

        --new state labels for the newSuffix path
        newStates = [newIndex .. newIndex + …
Run Code Online (Sandbox Code Playgroud)

performance garbage-collection haskell ghc

38
推荐指数
2
解决办法
8549
查看次数

标签 统计

garbage-collection ×1

ghc ×1

haskell ×1

performance ×1