Upload
yusuke-miyazaki
View
343
Download
0
Embed Size (px)
DESCRIPTION
2014/10/25 CAMPHOR- 秋のLT会で発表した「Swift の問題点」のスライドです.
Citation preview
Problems with Swift
Yusuke Miyazaki2014/10/25 @CAMPHOR- HOUSE
Swift の問題点
Introduction
Swift
Swift• WWDC 2014 で発表された, Cocoa, Cocoa Touchのための新しいプログラミング言語
• Modern / Type Safe / Interactive (REPL / Playground)
• iOS 7+, OS X 10.9 Mavericks+ に対応
Master-Detail Application• 今後のスライドで何度か登場する, Xcode の Project Template のひとつです.
Runtime Library
Runtime Library• Swift のアプリでは Swift のランタイムバイナリがリンクされる
• バイナリ互換性が確保される
• バイナリサイズが増大する(Objective-C: 170KB -> Swift: 8.2MB)
OS X Yosemite / Xcode 6.1 / iOS 8.1 SDK / Master-Detail Application / Release build
Runtime Library• App Store のサイズ制限: 100MB (Cellular)
• ランタイムのアップデートでパフォーマンスが改善されうる (Ex. Xcode 6 -> 6.1)
• 将来は OS にランタイムライブラリが組み込まれる予定
https://developer.apple.com/swift/blog/
Build
Build Time
OS X Yosemite / Xcode 6.1 / iOS 8.1 SDK / Master-Detail Application / Release build /
$ xcodebuild clean; time xcodebuild
Array / Dictionary
Array / Dictionary• Objective-C の時から利用していた Foundation.framework の NSMutableArray, NSMutableDictionary
• Swift の Array<Int>, Dictionary<Int, Int>
• どちらが速いのか?
Without OptimizationiPhone 5s / iOS 8.1 (12B411)
-Onone
Time [sec]0 7.5 15 22.5 30
NSMutableArray Swift Array<Int>NSMutableDictionary Swift Dictionary<Int: Int>
iPhone 5s / iOS 8.1 (12B411)
-O
Time [sec]0 0.04 0.08 0.12 0.16
NSMutableArray Swift Array<Int>NSMutableDictionary Swift Dictionary<Int: Int>
With Optimization
まとめ• “Swift will continue to advance.” (Apple)
• Swift を採用するならいろいろ気をつけましょう
• パフォーマンス上の問題
• ビルドの問題
• 仕様の変更 (Cocoa, Cocoa Touch を含め)