Who cares about toString performance? Nobody! Except when you have huge amount of data being processed in a batch that does plenty of logging using toString . Then, you investigate why it’s slow, realize that the toString method is mostly implemented using introspection and can be optimized. But first, let’s have a look at the Javadoc to remember what a Object.toString should do: “returns a textually representation … Continue reading Who Cares About toString Performance?
I’m sure you’ve all heard that assigning a variable to null helps the Garbage Collector, or not declaring a method final improves in lining…. But what you also know is that JVMs have evolved drastically and what was true yesterday may not be true today. So, how do we know that our code performs? Well, we don’t, because we are not supposed to guess what the JVM does… we just … Continue reading Micro Benchmarking with JMH: Measure, don’t guess!