Async Algorithms
Generated on 8/13/2024
1 search
The concept of async algorithms in Swift is explored in the session titled "Explore Swift performance" at WWDC 2024. In this session, async functions are described as being implemented in two special ways: they keep their local state on a separate stack from the C stack, and they are split into multiple functions at runtime. This allows for efficient memory allocation and deallocation, as async tasks hold onto one or more slabs of memory, which can be allocated and deallocated as needed.
The session explains that async functions are split into partial functions that span the gaps between potential suspension points. For example, if there is one await
in a function, it results in two partial functions. The first partial function handles the entry to the original function and awaits the task, while the second picks up after the await, processes the result, and continues the loop if necessary.
For more details, you can refer to the chapter on "Async functions" in the session Explore Swift performance (24:33).
Explore Swift performance
Discover how Swift balances abstraction and performance. Learn what elements of performance to consider and how the Swift optimizer affects them. Explore the different features of Swift and how they’re implemented to further understand the tradeoffs available that can impact performance.
What’s new in Swift
Join us for an update on Swift. We’ll briefly go through a history of Swift over the past decade, and show you how the community has grown through workgroups, expanded the package ecosystem, and increased platform support. We’ll introduce you to a new language mode that achieves data-race safety by default, and a language subset that lets you run Swift on highly constrained systems. We’ll also explore some language updates including noncopyable types, typed throws, and improved C++ interoperability.
A Swift Tour: Explore Swift’s features and design
Learn the essential features and design philosophy of the Swift programming language. We’ll explore how to model data, handle errors, use protocols, write concurrent code, and more while building up a Swift package that has a library, an HTTP server, and a command line client. Whether you’re just beginning your Swift journey or have been with us from the start, this talk will help you get the most out of the language.
Go further with Swift Testing
Learn how to write a sweet set of (test) suites using Swift Testing’s baked-in features. Discover how to take the building blocks further and use them to help expand tests to cover more scenarios, organize your tests across different suites, and optimize your tests to run in parallel.