String deduplication coming in Java8U20 in the G1 GC


Just found this link on reddit.
Basically, it’s a new GC improvement in Java8 U20 where the GC compares strings’ char array’s contents and if they contain the same thing it’ll update the references to point to a single char array and removes all the other arrays. Smart stuff I say, and while it comes with a bit of a performance overhead I can see this being useful for lots of applications. Nice thing is that this is (at least for now) completely optional and to access it you have to be using the G1 GC with the [icode]-XX:+UseG1GC[/icode] switch, so the performance overhead of this feature won’t be applied to your application/game if you don’t want it to.

Any thoughts on this? :slight_smile: