2 ms·
The issue isn’t the format. Class loading includes bytecode verification (verifying the type soundness of whatever code the class files contain), and then execu
by layer8 3y ago
The issue isn’t the format. Class loading includes bytecode verification (verifying the type soundness of whatever code the class files contain), and then executing the initialization code defined by each class (static code blocks etc.).
The optimizations in JDK 9 are for reducing the file size of the JDK (in terms of number of classes) when distributed with a standalone application, but that by itself doesn’t significantly affect startup time I believe, because classes are lazy-loaded only as required in any case.
- mike_hearn 3y agoThe jimage format does optimize startup a bit because it builds a perfect hashtable to go from class name to classfile bytes. On the classical classpath that requires an O(N) scan of the JARs in the app.
- erik_seaberg 3y agoDoes a JVM really need to re-verify the standard library it ships with?
- layer8 3y agoIt’s actually the default to not do that (-Xverify:remote). So I was probably wrong about bytecode verification being a relevant part of startup time, unless you count the application itself.