- 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!
- UNIX編程藝術
- HornetQ Messaging Developer’s Guide
- iOS面試一戰到底
- SpringMVC+MyBatis快速開發與項目實戰
- Java Web程序設計
- 薛定宇教授大講堂(卷Ⅳ):MATLAB最優化計算
- Android 應用案例開發大全(第3版)
- Microsoft System Center Orchestrator 2012 R2 Essentials
- INSTANT Django 1.5 Application Development Starter
- JavaScript入門經典
- Django實戰:Python Web典型模塊與項目開發
- Python預測之美:數據分析與算法實戰(雙色)
- Java高手是怎樣煉成的:原理、方法與實踐
- Web前端測試與集成:Jasmine/Selenium/Protractor/Jenkins的最佳實踐
- Building Clouds with Windows Azure Pack