summaryrefslogtreecommitdiff
path: root/hadrian/src
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2020-01-12 18:30:01 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-02-08 10:19:10 -0500
commit88bf81aaaf67e9c9bb5b12088ab33accd4a55fb3 (patch)
tree7e56f3ea22993d2dab41ba4b5f9b8745e230d33d /hadrian/src
parent7d04b9f298c9cc0ff291e0717826743f488670bb (diff)
downloadhaskell-88bf81aaaf67e9c9bb5b12088ab33accd4a55fb3.tar.gz
Optimize unpackCString# to allocate less.
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 'hadrian/src')
0 files changed, 0 insertions, 0 deletions