[LLVMdev] OCaml and Exceptions
echristo at apple.com
Sun Nov 25 14:16:31 PST 2007
On Nov 25, 2007, at 2:00 PM, Jon Harrop wrote:
> Ok. Might as well start by reusing as much as possible. Exceptions
> are very
> common in OCaml though. Is my 6x result a fair quantitative estimate
> of how
> much faster exceptions could be make in this system for my compiler
> if it
> were customized?
The idea behind the implementation of C++ exceptions is that C++
handle "exceptional" conditions, not normal code path. I.e. If you're
exception in the course of normal execution, there's something wrong
code. This means that C++ exceptions handle the normal case very well
overhead), but that the exceptional condition is OK with being slower
as a tradeoff.
That said, I don't know much about OCaml and so don't know if this
fits the standard OCaml programming style. If throw/catch/etc are
meant to be
normal path of execution then a small cost up front in, for example,
could easily speed up execution later when you hit the throw.
More information about the llvm-dev