On Wed, Aug 7, 2013 at 8:14 AM, Bennie Kloosteman <[email protected]>wrote:

> I dont think the unwinding is the  performance issue   in C# its the
> actual throw you can do the throw in a tight loop with a deep stack and it
> is still  slow.. eg  throw does the following , copy the stack to an
> exception object then change all the addresses to string ( which probably
> does some reflection) .
>

Right. One reason for this is that there is a commonly used and advocated
C# convention that every throw creates a new object and therefore performs
an allocation (and potential garbage collection). It's not an excessively
bright way to proceed.

Throwing a previously allocated object, by contrast, should be just as fast
as returning a constant. "Just as fast" as in "not differing by more than
one or two total instructions incurred".

Or better yet just return back to the handler  but dont  copy the stack and
> build  the full information to the object if there is a GlobalHandler in
> scope..
>

Why on earth would you ever be copying the stack?


> Any form of  handling  is going to be at least 10-100 * slower than an if
> condition which returns a value  ( due to cache hits and exceptions
> preventing optomizations) ...
>

You're going to have to show me the supporting hard data on this assertion,
because speaking as a compiler guy who is also done processor architecture
this seems like a pretty unlikely assertion.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to