4 ms·
You can mostly trust the JVM to not optimize this the way you'd want for primitives. ValueTypes are int he works though, and using a supplementary library for p
by kjeetgill 5y ago
You can mostly trust the JVM to not optimize this the way you'd want for primitives. ValueTypes are int he works though, and using a supplementary library for primitive specialization like Trove or fastutil have become the norm for now. Not ideal, but tolerable!
- bradleyjg 5y agoIf your application needs that kind of control, use a more suitable, lower level language. If you just want that level of control for aesthetic reasons, get over yourself.
- kjeetgill 5y agoJava is that language though! It has primitives and primitive arrays and the language is built around many comfortable ways of using them compared to something "a bit more high level" like a python, javascript, or ruby; but you get to keep your compacting GC, chunky reflection, runtime introspection, compared to a C, C++ or rust. Primitives don't play well with the generics though, for decent enough reasons, so the standard library leaves out many conveniences that you can pull in as needed. Of course we're excited about them playing well together, but the sweet spot in the design space is still being worked out. We call that effort ValueTypes, lol. (well sorta. there's more to value types than just primitive specialization but i digress) I get that teasing jabs at java are always and fashion but consider that for many, it persists because it is a bit of a sweet-sport language. I think Go succeeds when it does for precisely the same reasons.
- bradleyjg 5y agoDon’t get me wrong, I like java and hate c++. I worry about the rapid pace of change post 8. Some of the changes seem great individually but trying to be everything to everyone is how you end up with c++.