4 ms·
This is not a Java question. If a C compiler can do it then a Java Virtual Machine can do it, provided that the C code of the JVM makes it so. There are many im
by memracom 9y ago
This is not a Java question. If a C compiler can do it then a Java Virtual Machine can do it, provided that the C code of the JVM makes it so. There are many implementations of the JVM so you really should be asking which JVMs do this. Oracle is not the only game in town, not to mention at least two open source JVMs where you could add whatever capabilities that you need.
On the other hand, if you are asking whether or not some magic compiler optimization will take your crappy code and make it run fast on SIMD, not only is that the wrong question but you have already lost the race.
The winners of the race asked the question, "How can we add a capability to our Java application to run computations fast using SIMD?" and they found number of ways to do this without relying on magic. It might be a bit of work to code because you have to do it with intent, like the old timers who placed code and data carefully on their drum memory computers to make the code run much faster. You can code with intent in any language on any platform, but because your intent is stronger than the asthetic perfection of the platform, things can look a little grungy to an outsider. Comment your code and document it well.
And ask yourself whether offloading the computation to a GPU might not be cheaper and even faster than SIMD.
- pnowojski 9y agoOften it is not that simple to change JVM, especially if your application is very fine tuned for a specific GC. In such case, is it always worth to spend hundreds of work hours for migration (and testing it afterwards)? Other aspect is the technical support or other legal/contract bindings. Besides, I wasn't asking for "magic compiler optimizations". I would prefer to use intrinsics directly. Is there a way to do that in Java?
- pjmlp 9y agoKind of. https://www.slideshare.net/RednaxelaFX/green-teajug-hotspotintrinsics02232013 https://www.slideshare.net/RednaxelaFX/green-teajug-hotspoti... Here is also a presentation about them https://www.youtube.com/watch?v=7J0RELNadks https://www.youtube.com/watch?v=7J0RELNadks Here is a list with some of them. https://gist.github.com/apangin/7a9b7062a4bd0cd41fcc https://gist.github.com/apangin/7a9b7062a4bd0cd41fcc The Panama JVM has more related to SIMD. Of course all of this is JVM specific and each one has its own set.