Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>After googling "hotspot bounds checking", <a href="http://ssw.jku.at/Research/Papers/Wuerthinger07/" rel="nofollow">a Paper with the Title "Array Bounds Check Elimination for the Java HotSpot™ Client Compiler"</a> shows up (as the first result) and gives us some insight:</p> <p>Abstract:</p> <blockquote> <p>Whenever an array element is accessed, Java virtual machines execute a compare instruction to ensure that the index value is within the valid bounds. This reduces the execution speed of Java programs. Array bounds check elimination identifies situations in which such checks are redundant and can be removed. We present an array bounds check elimination algorithm for the Java HotSpot™ VM based on static analysis in the just-in-time compiler.</p> <p>The algorithm works on an intermediate representation in static single assignment form and maintains conditions for index expressions. It fully removes bounds checks if it can be proven that they never fail. Whenever possible, it moves bounds checks out of loops. The static number of checks remains the same, but a check inside a loop is likely to be executed more often. If such a check fails, the executing program falls back to interpreted mode, avoiding the problem that an exception is thrown at the wrong place.</p> <p>The evaluation shows a speedup near to the theoretical maximum for the scientific SciMark benchmark suite (40% on average). The algorithm also improves the execution speed for the SPECjvm98 benchmark suite (2% on average, 12% maximum).</p> </blockquote> <p>Mark Mayo explained this nicely. </p> <p>Bottom line: if Hotspot detects that it isn't necessary to check bounds for an array, it sees this as an oportunity to disable bounds checking for that array and therefore increase performance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload