- PCJ: https://pcj.sourceforge.net/
- fastutil: https://github.com/vigna/fastutil
- HPPC: https://labs.carrotsearch.com/hppc.html
PCJ was last updated in 2003 and is now quite long in the tooth though.
The Agrona Java library from the Aeron people has some primitive optimized collections too: https://github.com/aeron-io/agrona
https://en.wikipedia.org/wiki/Buffalo_buffalo_Buffalo_buffal...
I look forward to my next programming language ,"the"
And it's also confusing why people keep posting walled off articles on HN.
This is intellectually lazy. The performance characteristics of boxed vs unboxed primitives isn't forbidden knowledge from the necronomicon that only the select few are ready to partake in. Even if you think it's obvious, if you can back up an argument, go back up that argument. It makes your case stronger, it shows you know what you are talking about.
If not for other people, do it for yourself. Things that are too obvious to bother checking is generally where we're most likely to be wrong about things. This is true in life in general but it's especially true with the JVM and it's continuously evolving performance characteristics.
Main memory access is at worst case order of 100x slower than a cached read. With boxed primitives you very often looking and main memory access, whereas naked primitives can (when the planets align) amount to cached memory access.
From practical experience, JVMs have had an option to use compressed pointers for inner fields for two decades ( https://wiki.openjdk.org/display/HotSpot/CompressedOops ). It saves a bit of RAM, but often results in slower code.
More recently, the new ZGC collector started using colored pointers, there's a good presentation about it: https://inside.java/2025/10/06/jvmls-zgc-colored-pointers/ It's also been a mixed bag, performance-wise.
I saw go in the title so I just checked the HN comments first.
Or just use one of many languages that support generics over primitive types right now?! I get it, I also write Java but if some application would benefit greatly from some feature another language has, I don’t really think too much about it. Having a few languages under your belt is really good, and most companies these days know that and have at least a couple of “approved” languages. People normally can learn a new language fairly quickly. With AI now it’s easier than ever.
- Free, high quality concurrent GC
- Advanced JIT with best-in-class runtime optimization of dynamic dispatch and virtual methods
- Depth of the Java ecosystem and tooling
I've written some fairly large applications where I dropped in these primitive-specialized collections when needed, it really presented no issues and was quite a bit simpler than a leap to an entirely new language and runtime. They can be composed fairly easily into AoS style data structures.
To be honest the bigger headache from the current lack of value types comes from not being able to work with more involved temporary objects without the JIT giving up on escape analysis and putting them on the heap, which requires putting hacky approximations of out params in local fields. I'm optimistic this is going to be one of the earlier optimizations delivered by Valhalla.
No specialised generics at first, and this "beta" Early Access flattens only tiny objects on the heap, but changes to both will come later. Most of the foundation is there.
Just in case someone wants to feel old. C was younger when Java 1.0 was launched than Java is now.
https://dst.lbl.gov/ACSSoftware/colt/
https://en.wikipedia.org/wiki/Colt_(libraries)
https://link.springer.com/chapter/10.1007/978-1-4302-0854-9_...
gethly•7h ago