The engineering team at German consultancy codecentric writes about Java, JVM internals, databases, infrastructure debugging and software practices.
HN links it for JVM memory and pointer-compression details, the OpenStack debugging story, Apple's goto fail bug, and GraphQL security. Commenters treat it as a useful technical reference.
Can't understand why people in this thread seem so ticked about this.
The author's observation is interesting and useful to know, but this is an edge case that is easily fixable and actually kind of the fault of user code, not the implementation or the spec.
Its not so simple to just say "I can't believe they changed the performance of xyz"... the author's article is about just one usage pattern, and there is no evidence presented to show it is very common compared to others. Developers needing specific behavior for this pattern could easily have used java.nio.CharBuffer which makes allocation/copying/access to the underlying array/etc explicit, and just happens to implement CharSequence. No reimplementation of String necessary.
In general, Java is not C or C++, and has never been billed as a platform where you could rely on the internal representation of anything unless it is specified as such. Even the same bytecode running on the same platform on the same machine can run differently if the hotspot compiler says Make It So. That of course assumes you are even using Oracle's JVM or OpenJDK... there are in fact other implementations of both the JVM and the standard library that are free to implement things however they want.
Even within the Oracle/OpenJDK sphere - there are 4 different garbage collectors which all could affect this pattern differently. There is even a new String dedup feature that would have an impact on the internal behavior of…
I don't believe that's the case (an other commenter notes they run solr processes up to 160GB), however they may have run into the compressed oops optimisation, or more precisely the end of it: because Java is a very pointer-heavy language, if the maximum heap size is under 32GB many 64b JVMs use a variant of tagged pointers where they have 35 bit pointers stored in 32 bits (since the lower 3 bits are always empty they can shift them in/out).
Except once you breach the 32GB limit, your 32 bit pointers grow to 64, and depending on your application you might need to grow your maximum heap into the high 40s to get room for new objects: https://blog.codecentric.de/en/2014/02/35gb-heap-less-32gb-java-jvm-memory-oddities/
The compiler cannot reorder the fields.
This stuff comes up occasionally in optimizing layout of language VM structures, compilers, in the Linux kernel and other low level situations.
I.e. JVM compressed object pointers rely on the alignment and the native objects representation is definitely well laid out to not waste space due to alignment:
https://stackoverflow.com/a/25120926
https://blog.codecentric.de/en/2014/02/35gb-heap-less-32gb-java-jvm-memory-oddities/
Lua implementation similarly cares about alignment in some cases:
http://lua-users.org/lists/lua-l/2009-02/msg00305.html
This is not exactly 'struct packing' but alignment is closely connected to padding so its part of a wider interconnected topic.
Present courses often have a great deal of unrecognized uncertainty and risk too:
https://blog.codecentric.de/en/2013/12/never-change-running-system-wrong/
Decision theory generally proceeds as follows: map out all possible outcomes, all possible courses of action, estimate probabilities of each action leading to each outcome, and choose the action with best outcome distribution.
So far I haven't seen anybody argue against it directly... the problem instead is availability, most people aren't aware of it and can't or don't use it on a daily basis.
I wonder why the author doesn't call this construct by its name: Lambda functions?
I'm not using Java anymore, but this write up seemed nice: https://blog.codecentric.de/2013/10/java-8-erste-schritte-mit-lambdas-und-streams/ It's in German, though - I couldn't find a similar nice English write-up with 2 minutes of googling.
Using the super cheap 433mhz wirelessly switchable power plugs using the raspberry pi is also super low cost, it's just not secure against tampering.
https://blog.codecentric.de/en/2013/03/home-automation-with-angularjs-and-node-js-on-a-raspberry-pi/ has some details.