Throwable.TraceInfo

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 28 06:43:44 PST 2015


On Wednesday, 28 January 2015 at 14:41:43 UTC, david wrote:
> On Wednesday, 28 January 2015 at 14:17:36 UTC, Dicebot wrote:
>> AFAIK it is exactly generation of stack trace that takes so 
>> long. Recently it was changes to be generated lazily which is 
>> why version without `toString` is much faster. I don't think 
>> it can be any better if you want stack trace. For getting just 
>> the exception data one can directly access `e.msg` / `e.file` 
>> / `e.line`
>
> I'll try to hack away a version with my own handler - and check 
> what's actually taking time there.
> However, I wouldn't think a simple stack traversal (basically 
> ~15 indirections) takes a 2-3ms - that's a million cycles for 
> 15 simple actions.
> I would assume something in the order of 100 cycles per frame 
> (say) - so you're left with handling in the usecs

Yeah, sorry, I wasn't reading carefully the first time - it is 
generation of actual stack trace strings with all symbols that is 
very costly, not raw traversal.

About the rationale for not exposing it - official position is 
that exceptions are for exceptional cases and if those happen 
often, then program is wrong. Yes, I do know that this is not 
very useful official position :)


More information about the Digitalmars-d mailing list