3 ms·
...but, if I've understood the proposal correctly, the public interface isn't changing. The user of String will never know, nor care, whether their string is im
by david-given 11y ago
...but, if I've understood the proposal correctly, the public interface isn't changing. The user of String will never know, nor care, whether their string is implemented as UTF-8 or ISO-8859-1. This is purely an implementation detail.
Personally, I'd be astonished if JVMs didn't already do this: way back when when I was working for a company that did embedded JVMs, it was one of the first optimisations we did. When class files were loaded, we'd look at each string, and if they were ISO-8859-1 we'd use a byte-based representation rather than a word-based one. (Programmatically created strings were always words, of course.)
Even in an environment where most of our customers were Asian the savings were huge. Java uses a lot of identifier strings.