-
Notifications
You must be signed in to change notification settings - Fork 12
Description
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.shcurrently defaults to Assertions ON, unless it sees a-[DU]ASSERTIONSargument inCPPFLAGSorFFLAGS(which then take precedence). This can also be overridden atfpminvocation time.- Builds without
install.shthat pass no-[DU]ASSERTIONSargument 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.