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
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
630
15年メンテしてきたdotfilesから開発トレンドを振り返る 2011 - 2026
giginet
PRO
2
510
Claude Codeログ基盤の構築
giginet
PRO
7
4.8k
Inside of Swift Export
giginet
PRO
1
3.6k
Swiftビルド弾丸ツアー - Swift Buildが作る新しいエコシステム
giginet
PRO
0
3k
SwiftでMCPサーバーを作ろう!
giginet
PRO
3
500
Creating Intuitive Developer Tool in Swift
giginet
PRO
0
1.7k
Mergeable Libraryで 高速なアプリ起動を実現しよう!
giginet
PRO
2
8.8k
5分でわかるExplicitly Built Modules
giginet
PRO
2
2k
Other Decks in Programming
See All in Programming
Spec-Driven Development - Why Vaadin Is the Perfect Fit
simas
PRO
0
240
AIが実装を担う時代の「技術設計」と「チームマネジメント」
kamina_zzz
2
240
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
110
AmebaブログはKMPから卒業します
kmars0605
0
340
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
4
1.5k
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
140
ActionController meets Protocol Buffers
sorah
1
800
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.4k
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
410
Next.js: The final boss of Web Performance
guaca
0
390
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
330
PyConTW 2026 - AI Coding 不只是工具升級, 區域醫院醫療資訊系統協作開發與資訊團隊轉型實踐
cclai999
0
240
Featured
See All Featured
Faster Mobile Websites
deanohume
310
32k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
800
Become a Pro
speakerdeck
PRO
31
6.4k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
320
Fireside Chat
paigeccino
43
4.1k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
Are puppies a ranking factor?
jonoalderson
2
4.2k
The SEO Collaboration Effect
kristinabergwall1
1
620
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
610
Git: the NoSQL Database
bkeepers
PRO
433
67k
Chasing Engaging Ingredients in Design
codingconduct
0
390
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͞ΕΔ͜ͱ͕͋Δ • ͱΓ͋͑ͣಉ࣭͡Λผʑʹ͓ͯ͘͠ • ҧ͏ճ͕ಘΒΕΔ͜ͱ͋Δ
͝ਗ਼ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠