Closed wismill closed 5 months ago
@wismill maybe pack "interesting" Char
s into a ByteArray
instead of list?
You mean using e.g. newPinnedByteArray
? But then I guess I can just reach for newPinnedByteArray#
and further functions from GHC.Exts
.
Anyway, you confirmed that pinned memory a good direction. Thanks for your insights. It may be worth noting it in the README
.
Not necessarily even pinned, copying continuous blocks of memory is extremely fast on modern processors. And any arrays over 3-4K are automatically pinned by RTS.
So I have the following situation in
unicode-data
:env
to create a list of chars to bench.Lately I have experimented a hack that creates a pinned “list” using the foreign interface. This is ugly but seems to work, thanks to pinned memory being excluded from GC.
@Bodigrim What do you think? Is there a better way? Note that we would like to keep the dependencies as small as possible.