On Thursday, November 30, 2017 16:48:10 Adam D. Ruppe via Digitalmars-d wrote: > On Thursday, 30 November 2017 at 16:12:04 UTC, H. S. Teoh wrote: > > Which brings us to the implementation of assert() itself. What > > about it makes it so big? I suspect most of the bloat comes > > from throwing AssertError, which pulls in the stack-unwinding > > code, which, if my memory is still up to date, suffers from > > performance issues where it tries to construct the stacktrace > > regardless of whether or not the catch block actually wants the > > stacktrace. > > That's false, I changed that many years ago myself, unless the > DWARF change involved that too, but I don't think so. > > What happens is the exception constructor walks the stack and > copies the addresses to a local, static buffer. This is very fast > - just walking a linked list and copying some void* into a > void*[64] or whatever - and little code. > > The expensive part of formatting it to a string, actually looking > up the debug info, parsing out the addresses, etc., is done > lazily when it is printed, which occurs only on demand or right > before the program terminates.
Yeah, that change was a _huge_ speedup. It had a significant impact on std.datetime's unit tests. - Jonathan M Davis