Object.getClass() is an operation that "feels" like it should be lightweight
and efficient but isn't, since it's implemented by native code. Under
hotspot, its performance lags behind other methods (e.g., Object.hashCode())
which are treated specially by the compiler. Improving the performance of
Object.getClass(), perhaps by inlining it, would have a significant positive
impact on serialization performance in particular.
Attached is a microbenchmark comparing the performance of Object.getClass() vs.
Object.hashCode().