Code becomes slower as more boxed arrays are allocated

后端 未结 2 1033
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-07 17:45

Edit: It turns out that things generally (not just array/ref operations) slow down the more arrays have been created, so I guess this might just be meas

2条回答
  •  不知归路
    2021-01-07 18:21

    You are paying linear overhead every minor GC per mutable array that remains live and gets promoted to the old generation. This is because GHC unconditionally places all mutable arrays on the mutable list and traverses the entire list every minor GC. See https://ghc.haskell.org/trac/ghc/ticket/7662 for more information, as well as my mailing list response to your question: http://www.haskell.org/pipermail/glasgow-haskell-users/2014-May/024976.html

提交回复
热议问题