[Haskell-cafe] looking for optimization advice
simonmar at microsoft.com
Fri Mar 26 13:24:16 EST 2004
> data PackedString = PS !(ForeignPtr Word8) !Int !Int
A ForeignPtr is a sum type, so it can't be unboxed unfortunately. This
is undoubtedly one cause of inefficiency in the code.
Depending on how you're using ForeignPtrs, you could possibly define a
specialiased kind of ForeignPtr that would be unboxable. This would
require using low-level non-portable stuff though. Are you using
mallocForeignPtr? Or adding extra finalizers to ForeignPtrs?
More information about the Haskell-Cafe