[Development] What kind of airplane we want to build?
Allan Sandfeld Jensen
kde at carewolf.com
Fri Jan 22 19:37:33 CET 2016
On Friday 22 January 2016, Bogdan Vatra wrote:
> On Friday 22 January 2016 10:55:34 Cristian Adam wrote:
> > On Fri, Jan 22, 2016 at 11:59 AM, Marc Mutz <marc.mutz at kdab.com> wrote:
> > > I'm not sure about what outcome to expect, and I don't remember any
> > > numbers
> > > posted by anyone else, either.
> >
> > From the David Stone's Writing Robust Code
> > <https://meetingcpp.com/tl_files/2014/talks/robust_code.pdf> page 34:
> >
> > Performance of exceptions when not thrown
> > ● Tested on gcc 4.9.2
> > ● Numbers relative to ignoring errors
> > ● With no destructors
> >
> > – 12.8% overhead for exceptions
> > – 32.8% overhead for return codes
> >
> > ● With destructors
> >
> > – 6.3% overhead for exceptions
> > – 18.7% overhead for return codes
>
> Hmm, so, using exceptions makes your code 12-20% faster. This is a good
> thing, right?. Most probably the binary size will be slightly bigger,
> let's see if it's 12-20% bigger (my hunch is that it will not be more than
> 5% bigger). I'll do some tests this weekend and I'll share with you the
> results.
>
> > And page 35:
> >
> > Performance of exceptions when thrown
> > ● Tested on gcc 4.9.2
> > ● Numbers relative to ignoring errors
> > ● With no destructors
> >
> > – 900% overhead for exceptions
> >
> > ● With destructors
> >
> > – 750% overhead
>
> As I said, exceptions are like *a life vest*, they should be used *only in
> critical situations* not everywhere.
>
Using them anywhere, can break code everywhere as the number of return points
and code paths immediately becomes near infinite. They shouldn't be used
PERIOD.
'Allan
More information about the Development
mailing list