Plan for Exceptions and @nogc?
via Digitalmars-d
digitalmars-d at puremagic.com
Wed Feb 18 12:29:38 PST 2015
On Wednesday, 18 February 2015 at 09:04:38 UTC, Matthias Bentrup
wrote:
> If you want to avoid lookup tables, you can of course
> add/remove catchers dynamically whenever you enter/leave a try
> block, that would add a small cost to every try, but avoids the
> (larger) table lookup cost on the catch.
There are many ways to get better performance than the current
regime, both dynamic and static approaches, with little execution
costs, but since most C++ programs don't rely on exceptions where
speed matters there is little incentive to improve considering
the complications in the backend. So I don't expect the C++ crowd
to do anything about it.
As a result C++ programmers that need speed can keep pretending
exceptions don't exist, and if you don't need speed, why are you
using C++? :-). Thus status quo persists and nothing interesting
happens.
D has made C/C++ compatibility a goal... so nothing is going to
happen with D either...
In most programs the possible call trees at a given point are
quite limited, like a regular expression, so with whole program
optimization you only need to special case catch blocks where the
program may stop unwinding. I.e. you could detect which of the
possible call trees you are in and unwind "multiple stack frames"
from the same code location. If only a few functions can call
you, you most certainly don't need to look up anything, right? If
the compiler is allowed to move beyond "the peephole separate
compilation viewpoint"...
More information about the Digitalmars-d
mailing list