[OpenJDK 2D-Dev] RFR: 8272805: Avoid looking up standard charsets
serb at openjdk.java.net
Sun Aug 22 06:28:18 UTC 2021
This is the continuation of JDK-8233884, JDK-8271456, and JDK-8272120.
See https://github.com/openjdk/jdk/pull/5063 and https://github.com/openjdk/jdk/pull/4951
In many places standard charsets are looked up via their names, for example:
This could be done more efficiently(up to x20 time faster) with use of java.nio.charset.StandardCharsets:
The later variant also makes the code cleaner, as it is known not to throw UnsupportedEncodingException in contrary to the former variant.
This change includes:
* jdk.xx packages
* Some places were missed in the previous changes. I have found it by tracing the calls to the Charset.forName() by executing tier1,2,3 and desktop tests. Also checked for "aliases" usage.
Some performance discussion: https://github.com/openjdk/jdk/pull/5063
Code excluded in this fix: the Xerces library(should be fixed upstream), J2DBench(should be compatible to 1.4), some code in the "java.naming"(the change there is not straightforward, will do it later).
Tested by the tier1/tier2/tier3 tests on Linux/Windows/macOS.
- Fix related imports
- Merge branch 'master' into standard-encodings-in-non-public-modules
- Cleanup UnsupportedEncodingException
- Update PacketStream.java
- Rollback TextTests, should be compatible with jdk1.4
- Rollback TextRenderTests, should be compatible with jdk1.4
- Cleanup the UnsupportedEncodingException
- aliases for ISO_8859_1
- Update imageio
- Initial fix
Stats: 333 lines in 48 files changed: 91 ins; 123 del; 119 mod
Fetch: git fetch https://git.openjdk.java.net/jdk pull/5210/head:pull/5210
More information about the 2d-dev