I am writing some performance critical Java Code and I am really no Java expert, to say this in advance.
I work with a model in which nearly all information can be calculated from the positions of non-zero entries in a changing array of about ~1000 integers (most of them zero). To reduce these calculations I am working on algorithms, that update the informations in constant time, when the array changes instead of recalculating them. This could lead to a lot of code like
...
info1[x][y][a] = ...
info1[x][x%2+y][b] = ...
if( info3[x][y][c]!=0 )
info2[x][y] = ...
if( some condition involving ~10 array entries) {
/** some expensive algorithm that is hopefully called rarely **/
}
info3[x][y] = ...
...
So i expect maybe 10 of such consecutive and mainly independent array writes with minimal calculations which will make up a very large portion of the lines the program has to run through. Should I expect the number of such simple consecutive operations to be relevant or does Java have means to execute 20 consecutive simple array writes about as fast as it can execute 10 or 2?