I thought it worth posting to highlight a change in Swift 5.10 that will be beneficial to anyone who has been finding that crashes in their Swift programs take too long to generate a backtrace (this is mainly a problem for server-side programs, where you'd ideally like the program to crash quickly so something can restart it, but you'd still like an actionable backtrace).
Specifically, we've added an new option to the SWIFT_BACKTRACE
environment variable that lets you control symbolication (which is the part of the process that is taking the time); if you set
SWIFT_BACKTRACE=symbolicate=fast
then the backtracer will look up symbols, but will not try to give line number information or decode inline frames. This should speed things up significantly in most cases.
If that is still a problem for your application, please do file an Issue about it, but you can also completely disable symbolication with
SWIFT_BACKTRACE=symbolicate=off
You'll still get a backtrace, but in the latter case it'll just have addresses. It does list the loaded images, so you should be able to work backwards from that information later on if you need to.
(I am looking into the amount of time it takes to do the full symbolication in these cases; hopefully at some point there will be some additional improvements there too.)