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:

...and I submitted two issues as the result of this quick performance
investigation. We also need better benchmarks for this.

Nashorn also generates the mammoth classes on many cases, and therefore
solving both should (at least marginally) help there as well.


More information about the core-libs-dev mailing list