4 ms·
I'm really surprised that it isn't a zero cost abstraction, doesn't the Java JIT inline?
by zamalek 11y ago
I'm really surprised that it isn't a zero cost abstraction, doesn't the Java JIT inline?
- Karunamon 11y agoI think there's some other secret sauce happening in there, especially since making the process parallelized is as easy as changing .stream to .parallelStream.
- pron 11y agoHotSpot (the OpenJDK JVM) does, and it should in this case, too, but this usage suffers from "the inlining problem"[1] and/or the profile pollution problem[2]. These are problems that are continuously addressed and improved with each release, but have not yet been satisfactorily resolved. [1]: http://www.azulsystems.com/blog/cliff/2011-04-04-fixing-the-inlining-problem http://www.azulsystems.com/blog/cliff/2011-04-04-fixing-the-... [2]: https://wiki.openjdk.java.net/display/HotSpot/MethodData https://wiki.openjdk.java.net/display/HotSpot/MethodData
- pjmlp 11y agoI think Graal does more aggressive inlining than Hotspot. Looking forward to the day it will be in the reference JDK.
- vitalyd 11y agoI don't think the 100M entries example suffers from inlining or profile pollution. It's just that the manual loop is going to be as tight as you can get it and it's likely the stream version leaves artifacts behind that are noticeable when the loop kernel is dead simple like this. -XX:UnlockDiagnosticVMOptions -XX:+PrintInlining will tell you whether this inlined, and dumping the JIT asm can be done to see what was actually generated.
- pron 11y agoDid you see that they're planning on making Graal a plugin of the standard OpenJDK build in Java 9? It's right there: http://openjdk.java.net/jeps/243 http://openjdk.java.net/jeps/243
- pjmlp 11y agoI know, but I imagine it will only be fully merged if Project Sumatra turns out to be integrated.
- pron 11y agoBut you'll be able to use it as a 100% Java plugin regardless.
- vitalyd 11y agoSumatra is dead, AFAIK. But why would graal depend on sumatra for integration? Bigger challenge is how to bootstrap graal itself such that compilation time and thus time to peak perf isn't degraded substantially.
- pjmlp 11y agoReally?! > But why would graal depend on sumatra for integration? The other way around. Since Sumatra depends on Graal, it being integrated, means Graal also has to be. Pity, since I learned about Maxime and JikesRVM back in the day, I have looked forward to the day the reference JVM would be meta-circular.
- pron 11y agoBut why do you think Graal wouldn't be integrated? They've already started the process with Sumatra or without.
- pjmlp 11y agoIt depends on which JIT you mean, there are plenty to choose from. In any case, at least JITWatch, Solaris Studio and Intel Intel Amplifier do allow to look at the generated assembly.