Our current layout for strings and vectors is to store their unencoded length in the first word, but there's really no good reason doing it this way it and it means you have to re-encode it when you access the length. I think this was originally done to make bounds checking simpler to understand, but it's basically the same encoded or not. Changing this would simplify the code a bit.
Arguably the same should be done for the character data in strings. We have the bits available, so using codepoints doesn't buy you anything except the work of de/re-coding.
It's technically possible to pack 3 codepoints per words (but not chars), but we don't do that.
Our current layout for strings and vectors is to store their unencoded length in the first word, but there's really no good reason doing it this way it and it means you have to re-encode it when you access the length. I think this was originally done to make bounds checking simpler to understand, but it's basically the same encoded or not. Changing this would simplify the code a bit.
Arguably the same should be done for the character data in strings. We have the bits available, so using codepoints doesn't buy you anything except the work of de/re-coding.
It's technically possible to pack 3 codepoints per words (but not chars), but we don't do that.