Java News from Saturday, November 29, 2003

Tip of the day: Avoid using instanceof if at all possible. It's ridiculously slow in many virtual machines. While profiling XOM, I have repeatedly traced bottlenecks down to instanceof checks. Removing all the instanceof checks from XOM boosted performance by about 10%. If I had to pick one area to optimize in future releases of Java, it would be instanceof and the rest of the reflection API. I see no fundamental reason this shouldn't be as fast as a couple of adds or a method invocation.