@Petr
What is turned off?
array_check() will simply check, if your given index is within the lower/upper bound range of the given array, hence it's responsible for the "subscript out of range" runtime error, if the index is too small/big.
As arrays are straight forward memory areas, the worst thing which may happen is a crash due to a segmentation fault, if your given index is out of range and this is not checked. But this makes no difference to the _MEM commands, which would have the same problem when $CHECKING is switched off. So you have to make sure your code is error free first, and this is explicitly mentioned at the $CHECKING wiki page:
Warning: Turning OFF error checking could create a General Protection Fault (or segfault). Use only with 100% stable sections of code.
And that's all what i suggest. I don't want to remove the array_check() function at all, but only if i'm sure everything is error free and then put it into a $CHECKING:OFF section to gain maximum possible speed.
Probably i also should explain here why i make this suggestion.
Working on my GuiTools project, there is that one function called RemapImageFS&(), which is responsible to Floyd-Steinberg remap every image on the fly as it is used in the GUI. This function was already pretty well optimized for speed, but i ever felt it could be better, if not all these array_check() calls would lurking around there even with $CHECKING:OFF.
So i put hand on this function again, replacing all usual array stuff with _MEM operations, hence building my own array functionality using _MEM stuff, and so got a nice speedup, reducing worst case processing time per image pixel from 2.5 micro seconds to 1.95 micro seconds, and best case time from 620 nano seconds per pixel to 130 nano seconds per pixel.
If you now say ok, the speedup is simply the effect of using _MEM instead of arrays, NO, cause what the _MEM operation does in $CHECKING:OFF mode is almost exactly what my edited C++ line from the post above does, a direct memory access to a precalculated memory address.