Jan Burse schrieb:
Currently I am planning to change the loop
to something like that:
Bla[] bla = new Bla[n];
for (int i=0; i<n; i++) {
bla[i] = createBla();
}
So that the JIT has less information on what
the loop is about, and to do some new
measurements. To be fair I would also use
createBla() in the lazy scenario. Lets see
what happens.
Maybe there is a bug somewhere else in the
application that leads to the performance loss.
There are also points in the application where
some of the bla elements are forcefully set
to null so as to release Bla objects:
...
bla[j] = null;
...
I am not sure whether these releases work
the same in the bulk and the lazy version of
the code. Need to check first.
So measurements have already shown that the
release gives some gain, measurements where
16000 ms vs. 9600 ms. The release condition
is more complicated than the lazy new
condition, but the overhead is compensated
the overall gain.
which an array element transitions from non-null to null.
re-initialization, it would be a fragile design under subsequent changes.