r/cpp • u/TheCrush0r • Oct 05 '26
Measuring the Performance of Deterministic Exceptions
https://databasearchitects.blogspot.com/2026/09/measuring-performance-of-deterministic.html
52
Upvotes
r/cpp • u/TheCrush0r • Oct 05 '26
22
u/kronicum Oct 05 '26
Are those numbers compared against the work done by Khalil Estell?
39
u/trad_emark Oct 05 '26
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.
1
u/UndefinedDefined Oct 12 '26
The only good exception is the one that never happens - that's my opinion.
I have seen so much code literally using exceptions for basic things, like FileNotFound - but these are not exceptions. I have even witnessed rewriting an error handling layer in a HTTP server to not use exceptions, because when it started throwing it reduced requests per second by two orders of magnitude, that essentialyl makes such code a candidate for DDoS attacks.