4 ms·
Check out the godbolt link I posted under desc's thread. The answer isn't that obvious. Both approaches have a conditional. The compiler/linker marks the except
by abainbridge 7y ago
Check out the godbolt link I posted under desc's thread. The answer isn't that obvious. Both approaches have a conditional. The compiler/linker marks the exception handling code as cold. In theory this could go in a section of the exe that the loader never pages into RAM. (I'm getting out of my depth here).
- thedance 7y agoYeah because that's going to go well: taking a major page fault whenever you throw. Let me know how that works at scale.
- cwzwarich 7y agoYou already take a page fault with DWARF exceptions, since the unwind / LSDA info is probably on a different page from any of your code, as well as the personality routine itself.
- lallysingh 7y agoIf you're throwing, performance isn't the concern. You just want to clean up, return your 500 or what not, and get back to a sane state.
- gpderetta 7y agothat potentially happen even with normal if based error handing. If the compiler thinks the error handling path is unlikely to be run, it can move it to a cold page.