5.4.28  Vector Index Bounds Checking

The Mythryl compiler by default on every vector-slot get or set checks the index to make sure it is in bounds. If the index is not both non-negative and less than the length of the vector the INDEX_OUT_OF_BOUNDS exception is raised. This prevents heap-corruption bugs but it also slows down vector-intensive code by more than a factor of two.

Vector index bounds checking can be disabled within a given sourcefile by putting the line

    #DO set_control "compiler::check_vector_index_bounds" "FALSE";

near the top of the file.

Be very afraid when using this control! Use it only on code which is both thoroughly tested and debugged and also demonstrably speed critical. Heap-corruption bugs are nasty enough in C, where the heap is simple and static; to corrupt the Mythryl heap, which is complex and highly dynamic, is to enter a whole new world of pain.

Comments and suggestions to: