5 ms·
> the whole Java standard library will still take years to change to use them, if it ever does. All Java collections (which are what really matters) are being
by pron 11y ago
> the whole Java standard library will still take years to change to use them, if it ever does.
All Java collections (which are what really matters) are being retrofitted alongside with the introduction of value types. As soon as value types are introduced (and the HotSpot team is working hard on that right now), all collections will be fully value-ready.
> Go already gives better tools than Java for managing native memory through cgo, which is a far less painful interface than JNI
JNI is being replaced by Project Panama: http://openjdk.java.net/projects/panama/ http://openjdk.java.net/projects/panama/ (you can already use a similar FFI already with JNR, which serves as a blueprint for Panama's FFI: https://github.com/jnr https://github.com/jnr I've used JNR to write a FUSE filesystem in Java without a line of C, and unlike JNA, it's fast!)
Besides, HotSpot runs C now, too, and quite well:
http://www.chrisseaton.com/rubytruffle/cext/ http://www.chrisseaton.com/rubytruffle/cext/
https://dl.dropboxusercontent.com/u/292832/useR_multilang_demo.mp4 https://dl.dropboxusercontent.com/u/292832/useR_multilang_de...
> Plus, sun.misc.Unsafe is probably going away, according to Oracle.
... only to be replaced by something much better: https://www.youtube.com/watch?v=ycKn18LtNtk https://www.youtube.com/watch?v=ycKn18LtNtk (Unsafe isn't going away until replacements are available).
> From what I've heard, Azul has a great GC, but the throughput is extremely low.
Not at all. Just a little lower than with HotSpot's throughput collector, and possibly higher than with G1 (although G1 changes a lot, so that might not be true).
- x0x0 11y agoIt feels weird to say this, but Oracle's stewardship of the jvm is making me really hopeful as an occasional ml developer. Consider the wish list: I want a garbage collected language where, for a handful of large/important data structures, I can sidestep gc and carefully control memory layouts for cache friendliness. I'd also like direct interop with blas and my aforementioned data structures. It looks like I may get all of this! And yes, I've done a bunch of work with misc.unsafe but it's nowhere near as nice as it could be. What the jvm really buys you is not having to build once for each platform; I distributed code that relied on c++11 features on 3 platforms while there was mixed compiler support and it was a bloody nightmare.
- pron 11y ago> I can sidestep gc and carefully control memory layouts for cache friendliness Memory layout and GC are two completely orthogonal issues. You will be able to control memory layout quite well with Valhalla (value types) and even on a finer-grained level with Panama if you need C interoperability. VarHandles (hopefully in Java 9) will give you safe access to off-heap memory. Currently you can do that with Unsafe, which is more work but still less than C++. > What the jvm really buys you is not having to build once for each platform Oh, I'd say it buys you a lot more: seamless polyglotism, exceptional performance even for dynamic stuff (dynamic languages, esp. w/ Graal, but even cool bytecode manipulation in Java or even simple code loading/swapping), and you get all that performance with unprecedented observability into the running platform.
- x0x0 11y agoI think I disagree about the observability -- vtune is a lot easier to use when just tuning straight C++ rather than java
- pron 11y agoAre you familiar with JMH's perfasm? http://psy-lob-saw.blogspot.com/2015/07/jmh-perfasm.html http://psy-lob-saw.blogspot.com/2015/07/jmh-perfasm.html And for profiling apps on production, I've yet to encounter a more thorough, low-overhead profiler than Java Flight Recorder.
- x0x0 11y agono but i'll check it out this afternoon. Thanks!
- threeseed 11y agoVTune is not too dissimilar to JProfiler. And as pron mentioned plenty of tools exist for lower level access.
- 11y ago
- Meai 11y agoWhich of the JNR projects is the one you used? There are three that sound like they would do the exact same thing: https://github.com/jnr/jnr-invoke https://github.com/jnr/jnr-invoke https://github.com/jnr/jnr-ffi https://github.com/jnr/jnr-ffi https://github.com/jnr/jffi https://github.com/jnr/jffi
- pron 11y agojnr-ffi is the high-level API (and the one I used). jffi is a low-level ffi used by jnr-ffi. Unfortunately, jnr-ffi is still missing one piece (which can be done with the low-level FFI), namely returning creating a function pointer to a Java method dynamically and passing it to C code.