"Checking" preprocessor option

Issue #51 new
Joseph Parker created an issue

It would be good to introduce a preprocessor CHECKING option that, when off, would remove checks, info writing, debug message etc from the code.

An example where this would be useful: profiling suggests that calls to unit_tests::debug_message are reasonably expensive (e.g. ~3% of the field solve run time). In production runs, all debug_message does is check that it is not meant to write anything, and then return. We'd save appreciable time by guarding calls to debug_message with proprocessor flags.

Perhaps we could use the current DEBUG make flag to do this?

Comments (3)

  1. David Dickinson

    I like the idea of this, as we've seen in BOUT++ it can be very useful. To enable consistent use of this I think we would have to consider converting files to be preprocessed by default. Alternatively we could move messaging etc. into a module that is preprocessed but I suspect this might be hard to keep general.

  2. Log in to comment