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
Quine, Polyglot, 良いコード
qnighy
4
640
subpath importsで始めるモック生活
10tera
0
300
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
2
670
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
4
640
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
CSC509 Lecture 12
javiergs
PRO
0
160
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.5k
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
920
CSC509 Lecture 11
javiergs
PRO
0
180
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
2
1.1k
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
1.9k
Featured
See All Featured
Writing Fast Ruby
sferik
627
61k
Happy Clients
brianwarren
98
6.7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Six Lessons from altMBA
skipperchong
27
3.5k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Practical Orchestrator
shlominoach
186
10k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
Site-Speed That Sticks
csswizardry
0
24
Large-scale JavaScript Application Architecture
addyosmani
510
110k
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