Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: David Rajchenbach-Teller <david.teller@univ-orleans.fr>
To: Helmut Brandl <helmut.brandl@gmx.net>, caml-list@inria.fr
Subject: Re: [Caml-list] Performance penalty of exception handling
Date: Wed, 16 Sep 2015 22:00:49 +0200	[thread overview]
Message-ID: <55F9CA71.60102@univ-orleans.fr> (raw)
In-Reply-To: <55F9BE16.1020502@gmx.net>

[-- Attachment #1: Type: text/plain, Size: 1126 bytes --]

I did some benchmarking a while ago.
You can find the summary here:
https://hal.inria.fr/inria-00432575/PDF/monad.pdf

Cheers,
 David



On 16/09/15 21:08, Helmut Brandl wrote:
> Hi all,
> 
> I use exeption handling quite frequently even in inner loops. A common
> pattern:
> 
>     let some_function ... =
>             ...
>            if cannot_compute then raise Not_found else value
> 
>     try
>         let value = some_function ... in
>         ...
>     with Not_found ->
>        handle_exception
> 
> I use this pattern even if the direct caller of "some_function" handles
> the exception. In many cases I could design "some_function" in a way
> that it returns an optional value and check the optional value in the
> caller. Is this significantly (at least 10%) faster? If not, I would
> stay with my present design. However I am pressed for performance in the
> inner loops (I am only interested in compilation to native).
> 
> Is there any information available on the preformance penalty of
> exception handling? Any hints? Thanks in advance.
> 
> Regards
> Helmut
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  parent reply	other threads:[~2015-09-16 20:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 19:08 Helmut Brandl
2015-09-16 19:15 ` John Whitington
     [not found]   ` <CAKR7PS9iibAcWVMbjahdkVn6KBXUZa0U88KwZEkqc-LzfaBUKg@mail.gmail.com>
2015-09-16 19:51     ` Milan Stanojević
2015-09-16 20:00 ` David Rajchenbach-Teller [this message]
2015-09-16 19:26 "Mark Adams"

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55F9CA71.60102@univ-orleans.fr \
    --to=david.teller@univ-orleans.fr \
    --cc=caml-list@inria.fr \
    --cc=helmut.brandl@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox