Important point is: Swift has no exceptions… From the Swift manual at apple: Error handling in Swift resembles exception handling in other languages, with the use of the try, catch and throw keywords. Unlike exception handling in many languages—including Objective-C—error handling in Swift does not involve unwinding the call stack, a process that can be computationally expensive. As such, the performance characteristics of a throw statement are comparable to those of a return statement.
> On 6 Mar 2017, at 14:35, Jérôme Duquennoy via swift-users > <swift-users@swift.org> wrote: > > Hi guys, > > I am right now building a presentation of the swift error management system > for some of my colleagues. > I can explain how it works from a dev’s standpoint, and how it interacts with > obj-c. But I would like to have a deeper understanding of it, and notably to > understand what the compiler does when a do … try block is found, how it > knows that there is such a block at the current level of the stack and jumps > to it, … > I have notably noticed that exceptions are much slower than a simple “return” > when building without optimisation, while it is just as fast when > optimisations are enabled. I would like to understand what causes that > difference. > > Sadly, I have not dived into the sources of swift up to now, which makes the > beginning of the investigation a bit hard. > Could anyone point me to some starting place where I could begin ? > > Thanks for your help ! > > Jerome > _______________________________________________ > swift-users mailing list > swift-users@swift.org > https://lists.swift.org/mailman/listinfo/swift-users
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users