Cache the length of a string.

Also removes -[appendCStringWithoutUTF8Checking:] as it is dangerous and
not compatible with this optimization.