When weaving and installing a lot of bytecode in Nashorn, the problem isn't so much the code regeneration as the class installation that is a bottleneck we can't do anything about. Even if we install many classes in bulk inside one doPrivileged operation it is still quite slow and about 15-25% of the compile time overhead.
java -jar dist/nashorn.jar -scripting --log=time ../test/script/basic/compile-octane.js
will show the class installation time as part of the code generation time as an exit hook.
Is there any trick to minimize class installation overhead or low hanging fruit inside the JVM to pick at regarding class installation overhead