Benchmark of try/catch

Jarrett Billingsley jarrett.billingsley at gmail.com
Mon Mar 23 06:15:00 PDT 2009


On Mon, Mar 23, 2009 at 4:59 AM, bearophile <bearophileHUGS at lycos.com> wrote:
> Part of the timings, seconds:
> N = 4_000_000:
>  C:       0.36
>  Java:    5.59
>  C++:     9.97
>  Psyco:  29.28
>  Python: 32.68
>  D:      48.76  SLOW=false
>  D:      88.45  SLOW=true

>From the D "Handling errors" page
(http://www.digitalmars.com/d/1.0/errors.html):

"Because errors are unusual, *execution of error handling code is not
performance critical.*"

What you're doing here is a blatant abuse of the exception system.  It
doesn't matter if it's a common idiom in Python.



More information about the Digitalmars-d mailing list