takeWhile uses Data.ByteString.span, which allocates one boxed Int, see haskell/bytestring#70
Basically it is a result of lack of nested CPR in ghc: https://ghc.haskell.org/trac/ghc/ticket/2289
Possible solution: write a hand optimized version of span, though it will uses bytestring internals, so will become a maintenance nightmare.
Task: measure the performance penalty because of boxing.
takeWhileusesData.ByteString.span, which allocates one boxedInt, see haskell/bytestring#70Basically it is a result of lack of nested CPR in ghc: https://ghc.haskell.org/trac/ghc/ticket/2289
Possible solution: write a hand optimized version of
span, though it will usesbytestringinternals, so will become a maintenance nightmare.Task: measure the performance penalty because of boxing.