The Caffeine library uses the Assert library to add many correctness checking assertions. This includes both internal sanity checks and also validation of input to PRIF calls. These assertions are extremely valuable for correctness validation and debugging, but also incur a runtime performance overhead.
As such, it's important to ensure clients of Caffeine choose the appropriate build mode for their use case, namely:
- Assertions ON: For correctness testing and validation
- Assertions OFF: For performance testing and production use
Currently there's no consistent explicit control for this build mode:
install.sh currently defaults to Assertions ON, unless it sees a -[DU]ASSERTIONS argument in CPPFLAGS or FFLAGS (which then take precedence). This can also be overridden at fpm invocation time.
- Builds without
install.sh that pass no -[DU]ASSERTIONS argument will result in the default behavior of Assertions OFF
To make matters worse, assertions are currently controlled in caffeine.c using a completely separate mechanism: they are enabled by default and -DNDEBUG in the C compiler flags turns them off.
This is messy and error-prone.
We should deploy a robust and uniform mechanism to control the Caffiene build mode.
The Caffeine library uses the Assert library to add many correctness checking assertions. This includes both internal sanity checks and also validation of input to PRIF calls. These assertions are extremely valuable for correctness validation and debugging, but also incur a runtime performance overhead.
As such, it's important to ensure clients of Caffeine choose the appropriate build mode for their use case, namely:
Currently there's no consistent explicit control for this build mode:
install.shcurrently defaults to Assertions ON, unless it sees a-[DU]ASSERTIONSargument inCPPFLAGSorFFLAGS(which then take precedence). This can also be overridden atfpminvocation time.install.shthat pass no-[DU]ASSERTIONSargument will result in the default behavior of Assertions OFFTo make matters worse, assertions are currently controlled in caffeine.c using a completely separate mechanism: they are enabled by default and
-DNDEBUGin the C compiler flags turns them off.This is messy and error-prone.
We should deploy a robust and uniform mechanism to control the Caffiene build mode.