5 ms·
You'll still be chasing pointers with these. What you (and myself and many others) are looking for are inline types[0][1] that are part of Project Valhalla[2].
by chris_overseas 7y ago
You'll still be chasing pointers with these. What you (and myself and many others) are looking for are inline types[0][1] that are part of Project Valhalla[2].
[0] https://openjdk.java.net/jeps/169 https://openjdk.java.net/jeps/169
[1] https://dzone.com/articles/valhalla-lw2-progress-inline-types https://dzone.com/articles/valhalla-lw2-progress-inline-type...
[2] https://wiki.openjdk.java.net/display/valhalla/Main https://wiki.openjdk.java.net/display/valhalla/Main
- abraxas 7y agoThanks, you're right on. That's what I'm after and that's exactly what Java needs to be useful for doing high performance computations in a sane fashion.
- dman 7y agoThat ship has sailed.
- xxs 7y agoYou have direct buffers but that's that... You can use multiple arrays of primitives, inverting the problem 90%. None of the solutions is optimal, easy to maintain, etc.
- abraxas 7y agoYes there is also the sun.misc.Unsafe class but of course that's skating on thin ice.
- seanmceligot 7y agoI switched to java from c in the mid 90's. I remember thinking how ridiculously wasteful it was to allocate an array on classes one at at time rather than as a block of memory. I think I was using berkeley DB at the time in c and it let you do that.
- BubRoss 7y agoDoes it strike anyone as odd that something trivial in toy languages from the 70s is a separate project 30 years in and named for the the heaven of the gods in the world of Java?
- lumost 7y agoOn the other hand the toy languages from the 70s never caught on. In many workplaces Java is considered the high performance language and most devs would prefer Python/PhP at 1/100th the performance.
- BubRoss 7y agoI don't know what point you are making, but C had structs in the 70s too and it hasn't been a technical hurdle to implement there either. It's literally a few instructions of asm.
- dajohnson89 7y agoI always thought array elements were contiguous in memory? Is it that the objects are contiguous, but the pointers are not? If so, this does seem pretty expensive and I wonder if there's any workarounds.
- touisteur 7y agoWell arrays if elementary types are contiguous, yes. Arrays of objects are arrays of references to instances. The references are contiguous, but they point to instances all over the place.
- dajohnson89 7y agothat makes perfect sense, thank you