David Cantrell wrote on Fri, Mar 19, 2010 at 04:04:33PM +0000: 
> On Thu, Mar 18, 2010 at 11:40:40AM -0400, Martin Cracauer wrote:
> 
> > FWIW, in C++ as of today's gcc, a function exiting with a thrown
> > exception is roughly 1000 times more expensive than a regular
> > call/return ...
> 
> "More expensive" defined how?  Memory usage?  CPU cycles?  Developer
> effort?

CPU cyles.


[...]
      28.1 nsec/call: 'rand'
      25.3 nsec/call: 'random'
    7401.7 nsec/call: 'cpp_testhrow_throw'
      15.9 nsec/call: 'cpp_testhrow_no_throw'
      13.7 nsec/call: 'cpp_testhrow_no_possible_throw'
       7.7 nsec/call: 'cpp_testhrow_no_cleanup_no_throw'
       3.5 nsec/call: 'cpp_testhrow_no_cleanup_no_possible_throw'
[...]

That has one object with a minimal destructor in the cleanup.

K8 2.4 GHz, gcc-4.3

Code at:
http://www.cons.org/cracauer/general-tester.cc

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <[email protected]>   http://www.cons.org/cracauer/
FreeBSD - where you want to go, today.      http://www.freebsd.org/

_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to