Consider compiling small strings to lists.
Motivation
Currently we compile strings to unpackCString#
applied to an Addr# of bytes.
This is fine for reasonable sized strings. While it adds runtime overhead it saves a lot of code size, and in many cases we will be able to share the work.
However this falls short in extreme cases like single letter strings. It's always better to compile to a string in terms of work as the work is done at compile time. But for very short string's of 1-2 chars it might also be better for code size.
Proposal
We should try to translate unpackCString# foo
to lists after all rule matching is done when foo represents a string of extremely short length.
It's not obvious where the cutoff should be, but I remember @bgamari working unpacking strings in chunks.
In which case applying this to strings which are smaller than one chunk would seem natural.
Translation needs to happen after rule matching as libraries commonly match on unpackCString# and we want to keep their ability to do so throughout the phases.