[Mono-dev] mono numerical performance

Konrad M. Kruczyński konrad.kruczynski at gmail.com
Sun Nov 20 14:28:19 EST 2011

On Sun, 2011-11-20 at 19:39 +0100, Dawid Weiss wrote:
> As far as I know the final on local variables is only a hint for the
> java compiler (javac), not jit (hotspot) engine. Detection of loop
> invariants is done at runtime (during code jitting) so there's really
> no difference between any of the following in modern Java jits:

Maybe that's the reason there is no local readonly in the C# language -
local variables are easily trackable. As to those used in closures (as
mentioned by Jonathan) - as far as I know, they aren't local variables
actually but rather fields in compiler-generated class which represents

Btw, about the documenting intent part - some of these cases may
probably be covered by the Code Contracts.

> 1) (final) int max = array.length;
> for (int i = 0; i < max; i++) {}
> 2) for (int i = 0; i < array.length; i++) {}

Yes, hotspot does really good analysis these days.


More information about the Mono-devel-list mailing list