Re:JEP254: proposal to represent Java Strings as ISO-8859-1
by david-given on Friday May 15, 2015 @11:44AM
(#9551328)
...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.
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.