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.6k
Mergeable Libraryで 高速なアプリ起動を実現しよう!
giginet
PRO
2
8.5k
5分でわかるExplicitly Built Modules
giginet
PRO
2
1.9k
Other Decks in Programming
See All in Programming
kubernetes コンポーネント開発入門 / 新卒N年目の勉強会&交流会!〜〇〇への誘い〜 #n_study
mazrean
0
200
XHTMLが残したもの
yosuke_furukawa
PRO
2
680
RSSとCodexを使ってX投稿自動化してみた
ochtum
0
110
スマート反転とウェブアクセシビリティ
camiha
0
180
PHPプロジェクトの結合バランスを可視化する #php_night
kajitack
0
230
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
0
150
Building an Out-of-Order CPU
latte72
1
750
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
130
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
1.1k
型解析で実現する Go の言語内 DSL / Conference に Go! タイムテーブルの歩き方 for Gophers
mazrean
0
140
ALB ログから Trace を気合で繋げる技術
fohte
7
880
AgentCore CLI で進化した AWS での AI エージェントの作り方 : 必要な機能を必要な時に
icoxfog417
PRO
2
290
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
55
8.3k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
420
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
980
Measuring & Analyzing Core Web Vitals
bluesmoon
9
990
Why Our Code Smells
bkeepers
PRO
340
58k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
4
620
Designing for Timeless Needs
cassininazir
1
470
Heart Work Chapter 1 - Part 1
lfama
PRO
9
36k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
270
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
470
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
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͞ΕΔ͜ͱ͕͋Δ • ͱΓ͋͑ͣಉ࣭͡Λผʑʹ͓ͯ͘͠ • ҧ͏ճ͕ಘΒΕΔ͜ͱ͋Δ
͝ਗ਼ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠