Just eliminated C++ exceptions in a complicated multithreaded library. It’s 15% faster despite all performance sensitive functions previously being declared noexcept, with no obvious explanation.
-
Show this thread
-
Exception throwing on Windows x64 is 8,000 CPU cycles in Visual C++ and 20,000 in clang, but grows to 1,800,000 when a debugger is attached to the process.
4 replies 19 retweets 144 likesShow this thread -
This cost is mind-boggling for what is essentially a goto-with-destructors. In the process of adopting the “zero cost exceptions” fallacy, modern platforms created a catastrophic performance cliff that makes the feature unusable in real software.
5 replies 8 retweets 188 likesShow this thread -
And it’s not just C++. Other languages build their exception models on top of C++ exceptions and the operating system level plumbing (why should the OS have anything to do with this?) so, for example, JavaScript exceptions are also impractically expensive.
10 replies 6 retweets 138 likesShow this thread
Note that Rust lets you change panic to abort for this reason, and the library ecosystem is designed such that libraries work without catchable panic enabled.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.