[nhc-users] fps and Foreign(Obj/Ptr)
Donn Cave
donn at avvanta.com
Wed Nov 5 15:23:50 EST 2008
Quoth Don Stewart <dons at galois.com>:
[... re ByteString performance ]
| I'd imagine there's others where space is a premium, where it would be
| no contest to use a packed representation.
Right, that was the initial attraction. I'm trying to put something
together to exercise a little IMAP parser, and that means chunks of
data that are potentially large enough that people worry about whether
the size value could be larger than 32 bits. So it makes sense to
use ByteStrings from the start - starting with socket input.
At the other end, selected bits of data go to the C++ UI, and that's
the other place where String isn't much use. That's where I was running
out of foreign objects, and the larger foreign[] does help, thanks!
Now I see I have a leak, though - the foreign objects are piling up
where I was hoping they'd be gc'd, so I have more work to do. Maybe
complicated by the fact that the Haskell producer and C++ consumer
of these data are in separate threads, but I don't think that's my
immediate problem. I bet if all Haskell objects were allocated in
a fixed 1024 element list, people would notice space leaks much more
quickly and reliably!
Donn Cave, donn at avvanta.com
More information about the Nhc-users
mailing list