Loading classes with many methods is very expensive
Aleksey Shipilev
aleksey.shipilev at oracle.com
Thu Oct 23 09:54:34 UTC 2014
Hi Martin,
On 23.10.2014 02:53, Martin Buchholz wrote:
> If you have a class with ~64k methods with a superclass that also has ~64k
> methods, class loading that single class will cost you ~30sec and calling
> Class.getMethods another ~10sec. Both are unacceptably slow. I think both
> are due to O(N^2) algorithms, the first in hotspot, and the second in
> Class.java.
Interesting, this is the profile:
http://cr.openjdk.java.net/~shade/8061949/calltree-1.txt
...and I submitted two issues as the result of this quick performance
investigation. We also need better benchmarks for this.
https://bugs.openjdk.java.net/browse/JDK-8061949
https://bugs.openjdk.java.net/browse/JDK-8061950
Nashorn also generates the mammoth classes on many cases, and therefore
solving both should (at least marginally) help there as well.
-Aleksey.
More information about the core-libs-dev
mailing list