diff options
author | Andreas Klebinger <klebinger.andreas@gmx.at> | 2020-01-12 18:30:01 +0100 |
---|---|---|
committer | Andreas Klebinger <klebinger.andreas@gmx.at> | 2020-01-17 13:02:33 -0500 |
commit | 98eaad9cb58596f5fa37667b1da802fcd96b41c2 (patch) | |
tree | 2ada1a665edb70c105adf85d97d4b4f39dbe4340 /.ghcid | |
parent | a71323ffebf7663c50025d2731bf9de2d04f82c3 (diff) | |
download | haskell-wip/unpackString.tar.gz |
Optimize unpackCString# to allocate less.wip/unpackString
unpackCString# is a recursive function which for each iteration
returns a Cons cell containing the current Char, and a thunk for
unpacking the rest of the string.
In this patch we change from storing addr + offset inside this thunk
to storing only the addr, simply incrementing the address on each
iteration.
This saves one word of allocation per unpacked character.
For a program like "main = print "<largishString>" this amounts
to 2-3% fewer % in bytes allocated.
I also removed the now redundant local unpack definitions.
This removes one call per unpack operation.
Diffstat (limited to '.ghcid')
0 files changed, 0 insertions, 0 deletions