|
|
|
|
|
by cogman10
890 days ago
|
|
> the story hasn't changed an awful lot since 2004 Um... yeah it has. For starters, hotspot wasn't even a part of the JVM at that point. But further newer JVM additions like the enhanced for loop eliminate a ton of conditions where someone would run into bounds checking. Doing a naked `a[i]` is simply not common java code. The JVM is far more likely today to remove the bounds check all together than it ever was in 2004. |
|
It is extremely common in performance sensitive code, 1) graphics & rendering 2) networking 3) buffers
> But further newer JVM additions like the enhanced for loop eliminate a ton of conditions > The JVM is far more likely today to remove the bounds check all together than it ever was in 2004.
There are more comments in this thread that clarify further, but Java is very commonly unable to eliminate bounds checks. You can test all of these things yourself with a quick benchmark - don't take my word for it! The JIT is not as great at this as common rhetoric claims it is.