Dave Korn <dave.korn.cyg...@googlemail.com> writes: > The > DW2 version has zero overhead in terms of execution time when no exceptions > are thrown, but adds a noticeable amount of memory usage for the eh tables.
For the extremely picky (and who among us is not extremely picky) there is still some overhead in the dwarf2 version. We do not have good separation between hot and cold code, which means that exception handling code occupies pages which otherwise contain useful instructions and in some cases even occupies useful instruction cache lines. Ironically, -freorder-blocks-and-partition, which seems tailor-made to fix this, is disabled when exception handling is used. Also, when exception handling is enabled, it becomes impossible to do certain types of instruction reordering. While this has only a mild effect on x86 with its out-of-order execution, it has a noticeable effect on in-order architectures, particularly those with delay slots. Look for all the uses of can_throw in the compiler to see the effect. This effect is more significant with -fasynchronous-unwind-tables. Ian