Evaluating Swift concurrency on the iOS platform : A performance analysis of the task-based concurrency model in Swift 5.5

University essay from KTH/Skolan för elektroteknik och datavetenskap (EECS)

Abstract: Due to limitations in hardware, raising processor clock speeds is no longer the primary way to increase computing performance. Instead, computing devices are equipped with multiple processors (they are multi-core) to increase performance by enabling parallel execution of code. To fully utilize all available computational power, programs need to be concurrent, i.e. be able to manage multiple tasks at the same time. To this end, programming languages and platforms often provide a concurrency model that allows developers to construct concurrent programs. These models can vary both in design and implementation. In September of 2021, a new version of the Swift programming language, most commonly used to develop mobile applications on Apple’s iOS platform, was released. This release introduced a new concurrency model, Swift concurrency (SC), featuring e.g. structured concurrency and the async/await pattern. The performance of a concurrency model is important, not the least because end users expect applications to be responsive and performant. This thesis investigates Swift’s new concurrency model from a performance perspective, comparing it to a previous model, Grand Central Dispatch (GCD). Six benchmark applications are developed and implemented in both the GCD and the Swift concurrency models. Three of the benchmarks are focused on exercising separate parts of the models in isolation. The other three use the models to solve classical computational problems: Fibonacci numbers, N-Queens problem, and matrix multiplication. A performance analysis is carried out to study the differences in execution time and memory consumption between the two models. The results show differences between the two models, especially in execution time, and indicate that neither model consistently outperforms the other. Finally, some possible avenues for future work are identified.

  AT THIS PAGE YOU CAN DOWNLOAD THE WHOLE ESSAY. (follow the link to the next page)