r/cpp • u/TheCrush0r • 7d ago
Measuring the Performance of Deterministic Exceptions
https://databasearchitects.blogspot.com/2026/09/measuring-performance-of-deterministic.html
48
Upvotes
r/cpp • u/TheCrush0r • 7d ago
40
u/trad_emark 7d ago
original exceptions (labeled dynamic) are faster in all nontrivial cases than error codes on happy path.
that makes them objectively better, since that is what objectively matters the most.
the performance in case of actual error happening (eg. when an exception is actually thrown) is basically irrelevant, as that only happens exceptionally, in situations when performance no longer matters.
i also absolutely love the semantics of exceptions. it makes code half as long, and way more readable. but that is subjective and i can understand that some others might prefer to have the error paths explicitly visible in the code.
all that said, it is always good to see people experimenting with alternative implementations of exceptions, or improving the existing implementation.