Finn Bock wrote:
Instanceof is exactly as fast as a simple function call
after warm-up.

That is not what I remembered,

[Snip] I'm surprised. I made some measurements with a JDK 1.3.0, with ~50 warm-up cycles to give HotSpot something to optimize, and vaguely remembered instanceof was slightly faster (~1%) than a foo(){return true;}. It may have something to do with the test setup. I wouldn't rule out I tested in a class without inheritance :-)

J.Pietschmann



Reply via email to