Zhao (
[email protected]) wrote:
: I am wondering how the latest Java compiler/JVM deal with accessor
: (getXXX setXXX). Is there any overhead using them comparing to making
: class members public and access them directly?
Hotspot inlines quite much nowdays. If you really care about
performance I suggest you get a profiler and try to measure the cost
of the accessors, most of the time there wont be any such cost.
However if you profile your application from start to finish with
method tracing enabled hotspot will not inline code. You have to start
your application without method tracing and enable it after some time
to see what got inlined. This is kind of evil, since this means that
many will profile and find a trace that does not look like the one on
the production server....
/robo