- Swift High Performance
- Kostiantyn Koval
- 187字
- 2021-08-05 16:36:23
Swift speed
I can guess you opened this book because you are interested in speed and are probably wondering, "How fast can Swift be?" Before you even start learning Swift and discovering all the good things about it, let's answer it right here and right now.
Let's take an array of 100,000 random numbers; sort it in Swift, Objective-C, and C using the standard sort
function from stdlib
(sort
in Swift, qsort
in C, and compare
in Objective-C); and measure how much time each would take.
Sorting an array with 100,000 integer elements gives us this:

And the winner is, Swift! Swift is 14.5 times faster than Objective-C and 2.3 times faster than C.
In other examples and experiments, C is usually faster than Swift and Swift is way faster than Objective-C. These measurements were done with Xcode 7.0 beta 6 and Swift 2.0. It's important to highlight that the improvements in Swift 2.0 were mainly focused on making it cleaner, more powerful, safer, and more stable, and preparing it for open sourcing. Swift's performance hasn't reached its full potential yet, and the future is so exciting!
- 一步一步學Spring Boot 2:微服務項目實戰
- 零起步玩轉掌控板與Mind+
- Mastering Objectoriented Python
- Learning Data Mining with Python
- MATLAB應用與實驗教程
- 信息技術應用基礎
- Advanced Oracle PL/SQL Developer's Guide(Second Edition)
- Webpack實戰:入門、進階與調優
- Mobile Device Exploitation Cookbook
- Learning Docker Networking
- ABAQUS6.14中文版有限元分析與實例詳解
- Secret Recipes of the Python Ninja
- Maven for Eclipse
- 城市信息模型平臺頂層設計與實踐
- Web前端開發技術實踐指導教程