Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
More Swift App Startup Time
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
giginet
PRO
June 16, 2017
Programming
2.2k
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
More Swift App Startup Time
#otemachi_swift #1
https://nikkei.connpass.com/event/58452/
giginet
PRO
June 16, 2017
More Decks by giginet
See All by giginet
🀄️ on swiftc
giginet
PRO
0
580
15年メンテしてきたdotfilesから開発トレンドを振り返る 2011 - 2026
giginet
PRO
2
450
Claude Codeログ基盤の構築
giginet
PRO
7
4.6k
Inside of Swift Export
giginet
PRO
1
3.5k
Swiftビルド弾丸ツアー - Swift Buildが作る新しいエコシステム
giginet
PRO
0
2.9k
SwiftでMCPサーバーを作ろう!
giginet
PRO
3
480
Creating Intuitive Developer Tool in Swift
giginet
PRO
0
1.7k
Mergeable Libraryで 高速なアプリ起動を実現しよう!
giginet
PRO
2
8.5k
5分でわかるExplicitly Built Modules
giginet
PRO
2
1.9k
Other Decks in Programming
See All in Programming
Java 27新機能 / Java 27 new features
kishida
2
130
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
850
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
0
100
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
110
GKE で Pod の見方を変えたら、スケールアウト時の挙動を真に捉えられた話
stkk
0
120
How I Stole PSI from Android Studio - DroidKaigi2026
worker8
0
120
XHTMLが残したもの
yosuke_furukawa
PRO
2
790
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
1
270
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
6
1.8k
What We Talk About When We Talk About XP
m_seki
2
610
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
3
540
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
2.7k
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
699
190k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.1k
HDC tutorial
michielstock
2
870
Darren the Foodie - Storyboard
khoart
PRO
3
3.9k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
Google's AI Overviews - The New Search
badams
0
1.6k
It's Worth the Effort
3n
188
29k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.5k
For a Future-Friendly Web
brad_frost
183
10k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Paper Plane (Part 1)
katiecoart
PRO
1
11k
Transcript
More Swift App Startup Time @giginet
@giginet • iOS Engineer @ Cookpad • ։ൃج൫ͬͯ·͢ • झຯɿήʔϜ։ൃ
• Contributor of fastlane
None
Agenda • ࠔ͍ͬͯΔ͜ͱ • Dynamic Linkerͱdyld 3 • LabͰฉ͍ͨ͜ͱ •
ىಈ࣌ؒͷޮՌతͳܭଌํ๏ • LabͰੜ͖Δʹ
ࠔ͍ͬͯΔ͜ͱ • Dynamic Framework͕͍
ࠔ͍ͬͯΔ͜ͱ • SwiftͷϥΠϒϥϦDynamic Frameworkͱͯ͠Ϧϯ Ϋ͞ΕΔ • Carthage • CocoaPods(use_frameworks!) •
૿͢ͱىಈ͕͘ͳΔ • ڥʹΑͬͯΫϥογϡ͢Δ
ཧ
ݱ࣮
Φεεϝηογϣϯ • App Startup Time: Past, Present, and Future •
https://developer.apple.com/videos/play/ wwdc2017/413/ • Optimizing App Startup Time • https://developer.apple.com/videos/play/ wwdc2016/406/
dyld 3 • ৽͍͠Dynamic Linker࡞ͬͯΔ • ࣮༻ஈ֊ʹͳͬͨΒϦϯΫ͕ΊͬͪΌૣ͘ͳ ΔΒ͍͠
Optimizing Startup Time • ىಈ࣌ؒߴԽͷݟͷηογϣϯ • ܭଌख๏ͱվળͷํ๏
Optimizing Startup Time Lab • ΊͬͪΌχονͳLab͕͔͋ͬͨΒฉ͖ʹ͍ͬ ͨ
LabͰฉ͍ͨ͜ͱ
Q. Dynamic FrameworkΛ૿ ͠·͘ΔͱΊͬͪΌ͘ͳͬ ͯࠔͬͯΔΜ͚ͩͲ૿͢ ͖Ͱͳ͍ʁ
A. ͤͳ
Q. Swiftͷݴޠػೳʹ namespaceͳ͍͠ɺ frameworkΘ͚ͳ͍ͱݫ͍͠ ͱࢥ͏Μ͚ͩͲ
A. ΫϥεʹprefixΛ͚ͭ· ͠ΐ͏
Q. dyld 3iOS 11ͰೖΔͷ ͔ʁ
A. ͳʹݴ͑Δ͜ͱͳ͍
• ۜͷؙͳ͍
ىಈ࣌ؒͷܭଌํ๏
1. InstrumentsΛ͏ • ʮApp Startup Time: Past, Present, and FutureʯͰհ͞ΕͯΔ
• Time Profiler • Static Initializer Call(iOS 11)
None
2. Instruments via CLI • ಉ͜͡ͱ͕ίϚϯυϥΠϯ͔ΒͰ͖Δ • instrumentsίϚϯυ • ͨͩ͠ɺग़ྗͨ͠σʔλGUIͰͳ͍ͱӾཡͰ
͖ͳ͍ʢύʔε͢Δํ๏ͳ͍ʣ • ৄ͘͠man instruments
$ instruments -t 'Time Profiler' -w ‘36AF1B72-C261-45BD- AE4A-6593D22F0A' ‘com.yourcompany.InitializeTimeProfiler' Instruments
Trace Complete (Duration : 11.811208s; Output : /Users/ giginet/Desktop/InitializeTimeProfiler/instrumentscli1.trace)
3. task_info + UI Test • task_infoͰCPU࣌ؒऔͬͯܭଌ͢Δͱྑ͍ͷ ͰʁͱݴΘΕͨ • didFinishLaunchingWithOptionsͰͷ࣌ؒΛ
औΔ
var info = mach_task_basic_info() var count = mach_msg_type_number_t(MemoryLayout.size(ofValue: info) /
MemoryLayout<integer_t>.size) _ = withUnsafeMutablePointer(to: &info) { infoPointer in return infoPointer.withMemoryRebound(to: integer_t.self, capacity: Int(count)) { (machPoin return task_info( mach_task_self_, task_flavor_t(TASK_BASIC_INFO), task_info_t(machPointer), &count ) } } print(info.system_time) print(info.user_time)
4. DYLD_PRINT_STATISTICS • ʮOptimizing App Startup TimeʯͰհ͞Ε ͯΔ • ͦΕͧΕͷͷҙຯηογϣϯΛݟΔ͜ͱ
None
Total pre-main time: 307.08 milliseconds (100.0%) dylib loading time: 213.98
milliseconds (69.6%) rebase/binding time: 39.27 milliseconds (12.7%) ObjC setup time: 25.78 milliseconds (8.3%) initializer time: 27.96 milliseconds (9.1%) slowest intializers : libSystem.dylib : 3.17 milliseconds (1.0%) libswiftCoreImage.dylib : 17.56 milliseconds (5.7%)
·ͱΊ • ͍ͷݱঢ়Ͳ͏͠Α͏ͳ͍ • ΞϓϦͷىಈ࣌ؒܭଌख๏ฉ͚ͨ • ࣗಈԽ͍ͨ͠ • Micro Framework
Architectureݬ • dyld 3Λ࠲͔ͯͭ͠͠ແ͍
See also • giginet/xcprofiler • https://github.com/giginet/xcprofiler
ΦϚέ LabͰੜ͖Δʹ
ΦϚέɿLabͰੜ͖Δʹ • ຊΛ࡞͍ͬͯ͘ • ʮΏͬ͘Γͬͯ͘ΕʯͱఝΛ͢ • ಉ͜͡ͱΛ2ਓҎ্ʹฉ͘
ຊΛ࡞͍ͬͯ͘ • ฉ͘͜ͱΛϦετԽɻจষ࡞จ͓ͯ͘͠ • ϝϞΛݟͤͳ͕Β࣭͢Δ
ʮΏͬ͘Γͬͯ͘Εʯͱ ఝΛ͢ • ѫࡰͨ͠Β߈ʮΏͬ͘Γͯ͘͠ΕཔΉʯ ͱ͔ݴ͓ͬͯ͘ͱେΏͬ͘Γͬͯ͘ΕΔ • ࠷ѱɺଧͪࠐΜͰΒ͏
ಉ͜͡ͱΛ2ਓҎ্ʹฉ͘ • ࣝྔʹ͕ࠩ͋Δ • ଞͷਓʹdelegate͞ΕΔ͜ͱ͕͋Δ • ͱΓ͋͑ͣಉ࣭͡Λผʑʹ͓ͯ͘͠ • ҧ͏ճ͕ಘΒΕΔ͜ͱ͋Δ
͝ਗ਼ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠