April 21, 2019
On 4/16/19 5:46 PM, Andrei Alexandrescu wrote:
> On 4/16/19 4:52 PM, Steven Schveighoffer wrote:
>> On 4/15/19 4:24 PM, Andrei Alexandrescu wrote:
>>> On 4/15/19 3:36 PM, Nicholas Wilson wrote:
>>>> On Monday, 15 April 2019 at 19:25:24 UTC, A wrote:
>>>>> It is well known that exceptions are much slower than their alternatives, but is there a performance cost for using try/catch, even when no Exception/Error is being thrown?
>>>>
>>>> There is a space cost for the unwind tables, but exceptions are faster than checking error codes all over the place (you do check them right? ;) ).
>>>
>>> Sadly that's not quite the case... we've run a bunch of test at Facebook back in the day and the sheer presence of unwinding disables a bunch of optimizations, notably code motion and everything enabled by it. The bottom line effect is quite unpleasant, in the single digits.
>>
>> It would be important to know what "the day" was. Because there have been a lot of improvements on LLVM. I wonder if some of this has been mitigated for LDC at least.
> 
> 2015. I'll ask for an update.

OP delivers... got this: "RAII code introduces unwind code which can constrain optimizations and keep more values alive after a callsite (that can throw) but it’s possible to annotate noexcept functions, and LTO can do that too (I mean probably, I didn’t actually check). LTO, autoFDO, and hot/code layout have been getting better in gcc and clang, plus tools like bolt can move cold unwind code bloat to cold pages and reduce TLB misses in hot functions that have unwinding."
April 29, 2019
On Monday, 15 April 2019 at 19:25:24 UTC, A wrote:
> It is well known that exceptions are much slower than their alternatives, but is there a performance cost for using try/catch, even when no Exception/Error is being thrown?

Herb Sutter ACCU presentation about this Exception Handling x Zero-Overhead: https://youtu.be/os7cqJ5qlzo?t=860

Matheus.
1 2
Next ›   Last »