Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Build Time Analyzer
Search
M
March 04, 2018
Programming
0
140
Build Time Analyzer
ビルド時間の改善
M
March 04, 2018
Tweet
Share
More Decks by M
See All by M
Combine
matsuda
0
69
Swift 5.1 - Property Wrapper
matsuda
0
40
Swift 5.1
matsuda
0
30
SafeArea
matsuda
0
51
URLProtocol
matsuda
0
63
APIKit
matsuda
0
90
Other Decks in Programming
See All in Programming
Ethereum_.pdf
nekomatu
0
460
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
CSC509 Lecture 11
javiergs
PRO
0
180
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
110
flutterkaigi_2024.pdf
kyoheig3
0
150
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
140
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
950
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1030
460k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Faster Mobile Websites
deanohume
305
30k
A Philosophy of Restraint
colly
203
16k
Music & Morning Musume
bryan
46
6.2k
KATA
mclloyd
29
14k
Designing the Hi-DPI Web
ddemaree
280
34k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Building Your Own Lightsaber
phodgson
103
6.1k
Designing Experiences People Love
moore
138
23k
Transcript
Ϗϧυ࣌ؒͷվળ 2018/02/23
͡Ίʹ • 2ఔલʹSwiftͷϏϧυ࣌ؒͷ͕͞ʹ • ରࡦํ๏͍͔ͭ͘հ͞Ε͍ͯͨΓͨ͠ • ͍ࣗͱײ͡Δ͜ͱ͋Γࢼͯ͠Έ͍ͨ ͱࢥ͍͕ͬͯͨɺ࣮ࡍʹࢼͨ͜͠ͱͳ͔ͬ ͨ
͡Ίʹ • ϓϩδΣΫτͷίʔυΛݟͨ࣌ʹ͜ΕϠ όͦ͏ͱࢥͬͨ • ࣮ࡍɺͳ͔ͬͨ͘ • ͕࣌ؒͰ͖ͨͷͰࢼͯ͠Έͨ
Ϗϧυ࣌ؒͷܭଌ
શମͷϏϧυ࣌ؒ • defaultsίϚϯυͰXcode্ʹϏϧυ࣌ؒΛද ࣔͰ͖ΔΑ͏ʹઃఆ͢Δ
શମͷϏϧυ࣌ؒ • DerivedDataআ • ΫϦʔϯʢ㵰+⇧+Kʣ • Ϗϧυʢ㵰+Bʣ
શମͷϏϧυ࣌ؒ • DerivedDataআ • ΫϦʔϯʢ㵰+⇧+Kʣ • Ϗϧυʢ㵰+Bʣ
None
ܭଌ༻ͷϏϧυઃఆΦϓγϣϯ -Xfrontend Swift compiler flags
[Build Settings] -> [OTHER_SWIFT_FLAGS] ʹઃఆ
-debug-time-function-bodies • -Xfrontend -debug-time-function-bodies • ϝιουผͷίϯύΠϧ࣌ؒΛଌఆ
-warn-long-function-bodies • -Xfrontend -warn-long-function-bodies=100 • ίϯύΠϧʹ100msҎ্͔͔͍ͬͯΔίʔυΛܯࠂ • Swift3.0Ҏ߱Ͱ༗ޮʁ • কདྷతʹআ͞ΕΔՄೳੑ
• https://github.com/apple/swift/commit/ 18c75928639acf0ccf0e1fb6729eea75bc09cbd5
-warn-long-expression-type- checking • -Xfrontend -warn-long-expression-type- checking=50 • ܕਪʹ50msҎ্͔͔͍ͬͯΔίʔυΛܯࠂ • Xcode9
GM͔Β
None
None
ϓϩδΣΫτ • Swift2.2 & Xcode7.1.1 • -warn-long-function-bodies -warn-long-expression-type-checking ͕͑ͳ͍
Ҏ߱ Swift2.2+Xcode7.1.1 ͰͷௐࠪͰ͢
ϝιουຖͷܭଌ
ܭଌπʔϧ • xcodebuild http://irace.me/swift-profiling • Build Time Analyzer for Xcode
https://github.com/RobertGummesson/BuildTimeAnalyzer-for-Xcode • xcprofiler
ܭଌπʔϧ • xcodebuild http://irace.me/swift-profiling • Build Time Analyzer for Xcode
https://github.com/RobertGummesson/BuildTimeAnalyzer-for-Xcode • xcprofiler
• gem install xcprofiler • Build Settings -> Other Swift
Flagsʹ -Xfrontend -debug-time-function-bodies Λઃఆ • Ϗϧυ • xcprofiler [PRODUCT_NAME or ACTIVITY_LOG_PATH] [options] xcprofiler
xcprofiler
None
ίʔυϕʔεͰͷվળ
ίʔυϕʔεͰͷվળ 1.ܕਪ ʢλΠϓώϯςΟϯάɺClosureɺGenericsʢϝιουνΣΠϯʣʣ 2.݁߹ʢྻɺจࣈྻʣ 3.Closures and lazy properties 4.Ternary Conditional
Operatorʢࡾ߲ԋࢉࢠʣ 5.Nil-Coalescing Operatorʢ??ʣ
ίʔυϕʔεͰͷվળ 1.ܕਪ ʢλΠϓώϯςΟϯάɺClosureɺGenericsʢϝιουνΣΠϯʣʣ 2.݁߹ʢྻɺจࣈྻʣ 3.Closures and lazy properties 4.Ternary Conditional
Operatorʢࡾ߲ԋࢉࢠʣ 5.Nil-Coalescing Operatorʢ??ʣ
ܕਪ λΠϓώϯςΟϯά
None
ྻͷλΠϓώϯςΟϯάΛ ͚Δ
Ϗϧυ࣌ؒ NT CFGPSF BGUFS ʢ‑ʣ
ܕਪ Closure
None
$MPTVSFʹܕΛ໌ࣔ
Ϗϧυ࣌ؒ NT CFGPSF BGUFS ʢ‑ʣ
ܕਪ GenericsʢϝιουνΣΠϯʣ
None
ϥΠϒϥϦ3VOFTʹΑΔ ΦϖϨʔλʔͷར༻ΛΊΔ ϝιουνΣΠϯΛΊΔ
Ϗϧυ࣌ؒ NT CFGPSF BGUFS ʢ‑ʣ
ྻͷ݁߹
Before
ԋࢉࢠΛBQQFOEϝιουʹมߋ
Ϗϧυ࣌ؒ NT CFGPSF BGUFS ʢ‑ʣ
จࣈྻͷ݁߹
Before
ԋࢉࢠΛΊͯ ΠϯϥΠϯల։ʹมߋ
Ϗϧυ࣌ؒ NT CFGPSF BGUFS ʢ‑ʣ
ԋࢉࢠΛKPJOϝιουʹมߋ
Ϗϧυ࣌ؒ NT CFGPSF BGUFS ʢ‑ʣ
ίʔυϕʔεҎ֎Ͱͷվળ https://github.com/fastred/Optimizing-Swift- Build-Times
None
·ͱΊ
• ͪΐͬͱͨ͠มߋͰ͔ͳΓͷ͕࣌ؒॖ • ඵʗ630ඵͷॖͳͷͰɺຊʹվળ͞Εͨͷ͔࣮ ײ͕ͳ͍ʢମײతʹϏϧυ࣌ؒ15͙Β͍ʣ • Not Swifty • Swiftݴޠ༷Λ׆͔ͨ͠هड़͕Ͱ͖ͳ͍
• ίʔυྔͷ૿Ճ • ίʔυͷՄಡੑ͕͕͋Δ߹ • ܕΛ໌ࣔ͢Δ͜ͱͰѲ͘͢͠ͳΔ
• Swift2.2+Xcode7.1.1ͷڥͰͷௐࠪͳͷͰɺ ࠓͷ࠷৽ͷSwift4+Xcode9ͷڥͰվળ͞ Ε͍ͯΔͷ͋Δͣ
Swiftyͳίʔυॻ͖ͭͭɺ ۠Γͷ͍͍ͱ͜ΖͰܭଌ͠ ͯΈͯɺۃʹϏϧυʹ࣌ؒ ͕͔͔͍ͬͯΔ߹ίʔυ Λݟͯ͠ΈΔ
Appendix • https://developers.cyberagent.co.jp/blog/archives/7815/ • https://medium.com/@fkei/xcodeͷϏϧυ࣌ؒΛॖ͢Δ ํ๏·ͱΊ-2017-10-20࣌-bea6dc4f9fc0 • https://qiita.com/ruwatana/items/21b25781a2f44ccf29e2 • https://qiita.com/you_matz/items/
e95f30023eccc8d96357 • https://qiita.com/rizumita/items/913b05d799b3712260f6