If one runs a classloader benchmark:
...with Nashorn-generated class files:
...and jdk9 executed as:
$ java -jar benchmarks.jar -wi 0 -i 30 -r 10s -p file=classes.jar
...one can produce this profile:
Looking closely at this profile, one can note a low-hanging fruit: exceptions are frequent. The call tree shows where the exceptions are instantiated. Another view in the profiler shows that a significant amount of time is spend in constructing the stack traces:
That's 6.6 seconds of total 313 secs of run (around ~2%).
I think we need to stop doing exceptions there, or at least throw the stackless exceptions.