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
610
15年メンテしてきたdotfilesから開発トレンドを振り返る 2011 - 2026
giginet
PRO
2
500
Claude Codeログ基盤の構築
giginet
PRO
7
4.7k
Inside of Swift Export
giginet
PRO
1
3.6k
Swiftビルド弾丸ツアー - Swift Buildが作る新しいエコシステム
giginet
PRO
0
3k
SwiftでMCPサーバーを作ろう!
giginet
PRO
3
490
Creating Intuitive Developer Tool in Swift
giginet
PRO
0
1.7k
Mergeable Libraryで 高速なアプリ起動を実現しよう!
giginet
PRO
2
8.6k
5分でわかるExplicitly Built Modules
giginet
PRO
2
1.9k
Other Decks in Programming
See All in Programming
パスワード再設定メールのURLについて知っておこう
uyuki234
0
160
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
1.1k
AIに “答え“を書かせるのを やめてみた
___akari11
0
120
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
280
Kotlinの15年とServer-Side Kotlin
n_takehata
1
150
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
310
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
380
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
270
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
180
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
2
690
Featured
See All Featured
Un-Boring Meetings
codingconduct
0
460
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
640
A Soul's Torment
seathinner
8
3.8k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
430
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
Speed Design
sergeychernyshev
33
2.2k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
540
Building Adaptive Systems
keathley
44
3.2k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
570
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
550
The World Runs on Bad Software
bkeepers
PRO
72
12k
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͞ΕΔ͜ͱ͕͋Δ • ͱΓ͋͑ͣಉ࣭͡Λผʑʹ͓ͯ͘͠ • ҧ͏ճ͕ಘΒΕΔ͜ͱ͋Δ
͝ਗ਼ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠