Re: Enhancements to the java.lang.StringCoding class

2017-07-03 Thread Xueming Shen
As Martin pointed out, the UTF-16 variants probably are not critical enough to have "special" fastpath implementation in StringCoding. If better performance of these UTF-16 charsets is really desired, it might be worth implementing the sun.nio.ArrayDe/Encoder interface in UnicodeDe/Encoder to

Re: Enhancements to the java.lang.StringCoding class

2017-07-02 Thread Martin Buchholz
Very high level: UTF-16 is not expected to be a popular encoding for text outside the JDK. Everyone is supposed to be migrating to UTF-8 from ISO-8859-1 and other legacy encodings. The fact that people (like you and I) are writing specialized encoders/decoders outside of the "real" charset implem

Enhancements to the java.lang.StringCoding class

2017-07-02 Thread John Platts
I was looking at the OpenJDK 9 code, and I noticed that optimizations for encoding and decoding from UTF-16 text could be added to the java.lang.StringCoding class. Here is how the optimized UTF-16 decoding could be implemented in java.lang.StringCoding: private static void byteSwapUTF16(byte[]