Performance of `compressed_base_array_unmanaged::operator[]`
In one of my applications the operator[] access to the array entries takes up to 5 % of total run-time. If i comment the index check out i gain this 5% run-time improvement.
I would suggest the two options:
- use preprocessor directives to (de-)activate the checks:
if (lb == j+n || *lb != i)
DUNE_THROW(ISTLError,"index "<<i<<" not in compressed array");
- implement
at(size_type i)
which includes the index checks and operator[] returns without checking.
The first option seems to be a little more 'dune-istl' like and less invasive, while the second one is similar to the behavior of a std::vector
.