CppCon 2021 has ended
Back To Schedule
Thursday, October 28 • 4:45pm - 5:45pm
Asserting Your Way to Faster Programs

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
It is common practice to use defensive runtime checks, such as C-style assertions to help ensure program correctness, especially during testing. However, when thorough testing and beta releases bring confidence that production software is acceptably defect-free, redundant checks' value gradually decreases. With the value of redundant runtime checks diminishing, disabling them becomes more reasonable as doing so can often lead to measurable performance improvements. Although these assertions are disabled, they still carry valuable information which could assist the compiler's optimizer - namely, that for every defect-free program, the expression stated in the inactive assertion must hold. Most C and C++ compilers optimize code based on actively checked assertions; however, there is currently no standardized support for harnessing that very same information once redundant checks are disabled.

This talk explores the potential impact of the compiler assuming inactive C-style assertion predicates on runtime performance. We then share the result of our raw empirical research applied to real-world production software leveraging Bloomberg's BDE libraries, contrasting relevant metrics - such as compile times, run times, and binary sizes - across various categories of software libraries and applications. It will turn out that there are substantial opportunities to improve performance having relatively little impact on compile times. Moreover, if runtime performance is not improved, it is rarely, if ever, made measurably worse.

avatar for Parsa Amini

Parsa Amini

Senior Software Engineer, APC Workforce Solutions

Thursday October 28, 2021 4:45pm - 5:45pm MDT
B) Summit 8/9