tpaviot/oce — Issue #201: OutOfRange checks and Debug/Release modes
Author: tpaviot
Created: 2011-11-20 23:22:36+00:00
State: open

In the gp_Mat.cxx source file (https://github.com/tpaviot/oce/blob/master/src/gp/gp_Mat.cxx), `Standard_OutOfRange`and `Standard_ConstructionError` checks are performed only in debug mode.

However, there are many other checks that are also performed in release mode. To test this, I simply added a line `cout << "OutOfRange check\n";` in the Standard_OutOfRange.hxx file, where the `Standard_OutOfRange_Raise_if`macro is defined. Running the testing suite, it appears that, even in release mode, this check is called *many* times (especially in the BRepMesh test). This is not consistent with the gp_Mat.cxx implementation.

Having all these calls only in debug mode would certainly result in a significant (?) performance improvement. However, it's hard to know, from a profiler like valgrind, from which methods these checks are called (due to the implementation of `Standard_OutOfRange_Raise_if`, which is not a function).

It's certainly worth looking into this issue, and measure possible performance improvements. Moreover, we can adopt a more agressive solution, and remove *all* checks from the release mode (for instance by creating an additional ENABLE_CHECKS cmake flag).