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
Apple silicon導入のウラガワ/ Introducing Apple silicon...
Search
Satoshi Komatsu
May 16, 2022
0
1.5k
Apple silicon導入のウラガワ/ Introducing Apple silicon and its behind the scenes
Satoshi Komatsu
May 16, 2022
Tweet
Share
More Decks by Satoshi Komatsu
See All by Satoshi Komatsu
WWDC Labsは怖くない。 Labsの準備とコツ、完全公開します / iOSDC-WWDC-Labs
tosh7
1
1.2k
10年以上の歴史を持つプロダクトのRosettaフリー / zozotown-rosetta-free
tosh7
0
2.1k
若手のうちから活躍したいんじゃ/ How to work well as a freshman
tosh7
0
93
Compositional Layoutは銀の弾丸になるのか~実際に導入してみて得た知見、全て公開しちゃいます~
tosh7
1
2k
三年間で100人以上の中高大学生にiOSアプリ開発を教えていて感じたこと
tosh7
1
3.8k
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The World Runs on Bad Software
bkeepers
PRO
65
11k
The Language of Interfaces
destraynor
154
24k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
167
49k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Six Lessons from altMBA
skipperchong
26
3.5k
Fashionably flexible responsive web design (full day workshop)
malarkey
404
65k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.2k
BBQ
matthewcrist
85
9.3k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
Transcript
Apple siliconಋೖͷϥΨϫ ςοΫϒϩάʹΓࠐΊͳ͔ͬͨɺެ։͠·͢ גࣜձࣾZOZO ZOZOTOWN։ൃຊ෦ ZOZOTOWNΞϓϦ෦ iOSϒϩοΫ খদ ޛ Copyright
© ZOZO, Inc.
© ZOZO, Inc. খদ ޛ(@tosh_3) 2020ZOZOςΫϊϩδʔζ(ݱZOZO)ʹ৽ଔೖࣾɻ ZOZOTOWNͷiOSΞϓϦͷ։ൃʹैࣄɻ झຯεϙʔπ؍ઓɻ 2 גࣜձࣾZOZO
ZOZOTOWN։ൃຊ෦ ZOZOTOWNΞϓϦ෦ iOSϒϩοΫ
© ZOZO, Inc. 3 ςοΫϒϩά ZOZOTOWN iOSνʔϜɺApple siliconಋೖ͠·ͨ͠ https://techblog.zozo.com/entry/zozotown-ios-apple-silicon
© ZOZO, Inc. 4 ςοΫϒϩάͷ༰·ͱΊ © ZOZO, Inc.
© ZOZO, Inc. 5 ςοΫϒϩά༰·ͱΊ "QQMFTJMJDPOಋೖ͠·ͨ͠ ɾiOSνʔϜશһͷɺIntel Mac͔ΒM1 ProͱҠߦ͠·ͨ͠
ɾM1 MacBook AirΛݕূػͱͨ͜͠ͱͰɺೋؒͰͷҠߦΛՄೳʹ ɾZOZOTOWN iOSRosettaΛ༻͢Δ͜ͱʹ͠·ͨ͠ ɾM1 MaxͰͳ͘M1 Proʹ͠·ͨ͠ ɾϏϧυ͕ʹͳΓ·ͨ͠
© ZOZO, Inc. 6 ςοΫϒϩά༰·ͱΊ *OUFM.BD͔Β"QQMFTJMJDPOͷҠߦλΠϜϥΠϯ
݄ 88%$ʹͯ "QQMFTJMJDPOൃදɻ ։ൃऀ͚ʹ%5,ɻ ݄ ݕূػͱͯ͠ɺ ..BD#PPL"JSΛߪೖ ݄ ݄ ݄ .1SP.BYൃද .1SPߪೖ .1SP౸ண "QQMFTJMJDPOҠߦ
© ZOZO, Inc. 7 ςοΫϒϩά༰·ͱΊ ݕূػಋೖͷഎܠ ɾM1ͷൃදͷλΠϛϯάͰ࣌ظঘૣ ɾࠓޙग़ΔϓϩϞσϧʹඋ͑ͨ४උ
© ZOZO, Inc. 8 ςοΫϒϩά༰·ͱΊ ࠓճಋೖͨ͠ͷεϖοΫ ɾ10ίΞCPU M1 Pro
ɾ32GBϢχϑΝΠυϝϞϦ ɾ1TB SSD →ෳͷXcodeΛཧ͢Δ͜ͱ͕͋ΔͷͰগ͠༨༟Λ
© ZOZO, Inc. 9 ςοΫϒϩά༰·ͱΊ .1SPΛબͨ͠ཧ༝ ɾ10ίΞCPUͷProͱMaxͷେ͖ͳҧ͍GPUίΞ ɾࠓ·Ͱͷ։ൃͰϝϞϦෆΛײ͡Δ͜ͱ͕ͳ͔ͬͨ ɹݕূػ(16GB)Ͱͳ͠
V.S. →࣮ࡍʹӡ༻͍ͯ͠ΔதͰɺշదʹ։ൃ͕Ͱ͖͍ͯΔ
© ZOZO, Inc. 10 ςοΫϒϩά༰·ͱΊ ϏϧυͷมԽ ɾZOZOTOWNϦϦʔεϏϧυͷϏϧυ࣌ؒͰൺֱ ɾxcode-build-times-renderingΛ༻ͯ͠ܭଌ ɾIntel
Mac(Core i9)ͱApple silicon Mac(M1 Pro)Ͱൺֱ
© ZOZO, Inc. 11 ςοΫϒϩά༰·ͱΊ ϏϧυͷมԽ ϦϦʔεϏϧυ Intel Core
i9: 625ඵ M1 Pro: 312ඵ →Ϗϧυ͕࣌ؒʹʂ
© ZOZO, Inc. 12 ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ © ZOZO, Inc.
© ZOZO, Inc. 13 ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ 3PTFUUBͱԿ͔ʁ RosettaͱARM64Ͱಈ͍͍ͯΔApple siliconԼʹ͓͍ͯɺx86_64༻ͷόΠ φϦΛಈ͔͢͜ͱͷͰ͖Δ༁ϓϩηε
© ZOZO, Inc. 14 ͳͥ3PTFUUBΛ༻͢Δ͜ͱʹͨ͠ͷ͔ ֎ͨ͠ঢ়ଶͰϏϧυʹ͍࣋ͬͯ͘͜ͱ͕͔ͬͨ͠ɻ →Carthageܦ༝ͰೖΕ͍ͯΔϥΠϒϥϦΛ.frameworkܗ͔ࣜΒ.xcframework ܗࣜͱมߋ͠ͳ͍ͱ͍͚ͳ͍ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔
© ZOZO, Inc. 15 9$'SBNFXPSLͱ Framework 📦 Universal Binary
→ෳͷΞʔΩςΫνϟ༻ͷόΠφϦϑΝΠϧΛ·ͱΊͨͷɻ ͨͩ͠ɺಉҰͷΞʔΩςΫνϟΛෳอ࣋Ͱ͖ͳ͍ iPhone༻ͷόΠφϦ(ARM64)ͱSimulator༻ͷόΠφϦ(x86_64) Λ·ͱΊΔ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ ⭕
© ZOZO, Inc. 16 9$'SBNFXPSLͱ Framework 📦 Universal Binary
→ෳͷΞʔΩςΫνϟ༻ͷόΠφϦϑΝΠϧΛ·ͱΊͨͷɻ ͨͩ͠ɺಉҰͷΞʔΩςΫνϟΛෳอ࣋Ͱ͖ͳ͍ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ iPhone༻ͷόΠφϦ(ARM64)ͱSimulator༻ͷόΠφϦ(ARM64) Λ·ͱΊΔ ❌
© ZOZO, Inc. 17 9$'SBNFXPSLͱ XCFramework ಉҰͷΞʔΩςΫνϟʹରͯ͠ෳͷόΠφϦΛ࣋ͭ͜ͱ͕Ͱ ͖Δܗࣜ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔
iPhone༻ͷόΠφϦ(ARM64)ͱSimulator༻ͷόΠφϦ(ARM64) Λ·ͱΊΔ ⭕
© ZOZO, Inc. 18 ;0;0508/ͷϏϧυߏ ZOZOTOWN Carthage CocoaPods ͦͷଞ
ϥΠϒϥϦ ZOZOSUIT ZOZOMAT ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔
© ZOZO, Inc. 19 ;0;0508/ͷϏϧυߏ Carthage CocoaPods ͦͷଞ ϥΠϒϥϦ
ZOZOSUIT ZOZOMAT ZOZOTOWN ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ XCFramework
© ZOZO, Inc. 20 ;0;0508/ͷϏϧυߏ Carthage CocoaPods ͦͷଞ ϥΠϒϥϦ
ZOZOSUIT ZOZOMAT XCFramework ❌ ❌ ZOZOTOWN ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔
© ZOZO, Inc. 21 ;0;046*5Λ9$'SBNFXPSLԽ͢Δͷ͕͍͠ཧ༝ ɾOpenCVͷXCFrameworkαϙʔτঢ়گ ɾΫϩεϓϥοτϑΥʔϜͷίΞΞϧΰϦζϜͷϏϧυ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔
© ZOZO, Inc. 22 0QFO$7ͷ9$'SBNFXPSLαϙʔτঢ়گ ɾZOZOSUITͰ༻͞Ε͍ͯΔOpenCVͷόʔδϣϯ͕3ܥ ɾOpenCVͰXCFrameworkରԠ͕͞Εͨͷɺ4.5.1Ҏ߱ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔
© ZOZO, Inc. 23 →3ܥͷόʔδϣϯͰ͋ͬͯɺࣗͰbuildઃఆΛௐ͢Δ͜ͱͰ XCFrameworkΛ࡞Δ͜ͱՄೳ ɾZOZOSUITͰ༻͞Ε͍ͯΔOpenCVͷόʔδϣϯ͕3ܥ ɾOpenCVͰXCFrameworkରԠ͕͞Εͨͷɺ4.5.1Ҏ߱ 0QFO$7ͷ9$'SBNFXPSLαϙʔτঢ়گ
ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔
© ZOZO, Inc. 24 ΫϩεϓϥοτϑΥʔϜͷίΞΞϧΰϦζϜͷϏϧυ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ XcodeͰͳ͘ɺϏϧυεΫϦϓτʹΑͬͯɺiOSAndroidͷͦΕͧΕͷ ΞʔΩςΫνϟ༻ͷ੩తϥΠϒϥϦΛੜ͍ͯ͠Δ
© ZOZO, Inc. 25 ΫϩεϓϥοτϑΥʔϜͷίΞΞϧΰϦζϜͷϏϧυ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ XcodeͰͳ͘ɺϏϧυεΫϦϓτʹΑͬͯɺiOSAndroidͷͦΕͧΕͷ ΞʔΩςΫνϟ༻ͷ੩తϥΠϒϥϦΛੜ͍ͯ͠Δ XCFrameworkͷཁٻΛͨͩຬͨ͢ͷͰ͋ΕɺiOS
SimulatorΛ1ͭͷϓϥο τϑΥʔϜͱͯ͠ذΛͤྑ͍ ҰํͰɺΓ͍ͨ͜ͱʹରͯ͠Өڹൣғ͕େ͖͗͢Δ͔͠Εͳ͍
© ZOZO, Inc. 26 ΫϩεϓϥοτϑΥʔϜͷίΞΞϧΰϦζϜͷϏϧυ ɾࣗୡͷνʔϜͰ݁͢Δ΄Ͳখ͞ͳͰͳ͔ͬͨ ɾXCFrameworkͷͨΊͷվमΛখखઌͰΔΑΓɺํ๏Λݕ౼͢Δ࣌ؒΛ ͱͬͨ΄͏͕ɺಘࡦ →ࠓճͷλΠϛϯάͰɺRosettaΛ༻ͯ͠ͷҠߦ
Rosetta͋ΓͰ͋ͬͯɺApple siliconಋೖʹΑͬͯ ಘΒΕΔޮՌେʂ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔
© ZOZO, Inc. 27 3PTFUUBͱͷ͖߹͍ํ © ZOZO, Inc.
© ZOZO, Inc. 28 3PTFUUBͱͷ͖߹͍ํ 3PTFUUBͱͷ͖߹͍ํ ɾRosettaΛ֎͢͜ͱͰϏϧυΛͬͱ͘Ͱ͖Δ ɾPlayground͕༻Ͱ͖ͳ͘ͳΔ ɾSimulatorͰεΫϩʔϧͷ׳ੑ͕ޮ͔ͳ͘ͳΔ
ɾΞϓϦέʔγϣϯ͝ͱͷRosettaͷ༻༗ແΛܾΊΔ
© ZOZO, Inc. 29 3PTFUUBΛ֎͢͜ͱͰϏϧυΛͬͱ͘Ͱ͖Δ ɾ࣮ػ(ARM64)ʹରͯ͠σόοάϏϧυΛߦ͏ ɾRosettaͰىಈͨ͠ͷͱRosettaͳ͠Ͱىಈͨ͠ͷͰϏϧυ࣌ؒΛൺֱ 3PTFUUBͱͷ͖߹͍ํ
© ZOZO, Inc. 30 Rosetta͋Γ: 235ඵ Rosettaͳ͠: 128ඵ ZOZOTOWNͷσόοάϏϧυͷ༷ࢠ 3PTFUUBΛ֎͢͜ͱͰϏϧυΛͬͱ͘Ͱ͖Δ
Intel Core i7: 348ඵ 3PTFUUBͱͷ͖߹͍ํ
© ZOZO, Inc. 31 1MBZHSPVOE͕༻Ͱ͖ͳ͘ͳΔ ɾXcodeΛRosettaͰىಈ͍ͯ͠Δ߹ʹૺ۰ ɾRosettaͳ͠Ͱىಈ͢Εͳ͘ಈ͔͢͜ͱ͕Ͱ͖Δ 3PTFUUBͱͷ͖߹͍ํ
© ZOZO, Inc. 32 4JNVMBUPSͷ׳ੑ͕ޮ͔ͳ͘ͳΔ RosettaͰϏϧυͨ͠ZOZOTOWNΞϓϦ RosettaͰىಈͨ͠Simulator Rosettaͳ͠Ͱىಈͨ͠Simulator 3PTFUUBͱͷ͖߹͍ํ
© ZOZO, Inc. 33 RosettaͰϏϧυ͞Ε͍ͯͳ͍Ͱ͋Ζ͏MapΞϓϦ RosettaͰىಈͨ͠Simulator Rosettaͳ͠Ͱىಈͨ͠Simulator 4JNVMBUPSͷ׳ੑ͕ޮ͔ͳ͘ͳΔ 3PTFUUBͱͷ͖߹͍ํ
© ZOZO, Inc. 34 9DPEF 3PTFUUBͳ͠ 9DPEF 3PTFUUB͋Γ 4JNVMBUPS
3PTFUUBͳ͠ εΫϩʔϧͷ׳ੑ⭕ εΫϩʔϧͷ׳ੑ❌ 4JNVMBUPS 3PTFUUB͋Γ εΫϩʔϧͷ׳ੑ❌ εΫϩʔϧͷ׳ੑ⭕ *XcodeͱSimulatorͷRosettaͷΦϯΦϑࣗಈͰಉظ͞Εͳ͍ 4JNVMBUPSͷ׳ੑ͕ޮ͔ͳ͘ͳΔ https://developer.apple.com/forums/thread/668488 3PTFUUBͱͷ͖߹͍ํ
© ZOZO, Inc. 35 3PTFUUBΛ༻͢Δڥͱ༻͠ͳ͍ڥ ɾRosetta͋ΓͰӡ༻͍ͯ͠ΔΞϓϦ - Xcode - Simulator
- Bundler(CocoaPods) ɾRosettaͳ͠Ͱӡ༻͍ͯ͠ΔΞϓϦ - Terminal - AppStore͚Ϗϧυͷ࡞ 3PTFUUBͱͷ͖߹͍ํ
© ZOZO, Inc. 36 $PDPB1PETʹ͍ͭͯ ɾGemͰೖΕͨCocoaPodsFFIपΓͷΤϥʔͷͨΊɺApple siliconԼͰͷ ࣮ߦ͕͍͠ →arch -x86_64Λ಄ʹ͚ͭͯӡ༻
ɾHomebrewܦ༝ͰೖΕΔͱApple siliconԼͰͳ͘ಈ͘ →BundlerʹΑͬͯCocoaPodsͷόʔδϣϯΛݻఆ͍ͨ͠ͷͰɺ༻͠ͳ͍ ɾͦͦZOZOTOWNͰPodsϑΝΠϧgitཧ͞Ε͍ͯΔͨΊɺinstall update͞ΕΔ͜ͱ͕গͳ͍ 3PTFUUBͱͷ͖߹͍ํ
© ZOZO, Inc. 37 9DPEFͰͷṖڍಈ © ZOZO, Inc.
© ZOZO, Inc. 38 9DPEFͰͷṖڍಈ ϦϦʔεϏϧυͷܭଌ࣌ؒଌఆத νʔϜͷͱ͋Δਓ 290ඵ 430ඵ
νʔϜͷଞͷϝϯόʔ
© ZOZO, Inc. 39 9DPEFͰͷṖڍಈ ϦϦʔεϏϧυͷܭଌ࣌ؒଌఆத MacͷεϖοΫɺOSҰॹ ಛผͳXcodeͷઃఆͳ͠ νʔϜͷͱ͋Δਓ
290ඵ 430ඵ νʔϜͷଞͷϝϯόʔ 140ඵ
© ZOZO, Inc. 40 9DPEFͰͷṖڍಈ ϦϦʔεϏϧυͷܭଌ࣌ؒଌఆத ~/Library/Developer/Xcode/DerivedData/[Ϗϧυͷݻ༗ࣝผࢠ]/Build/Intermediates.noindex/ ArchiveIntermediates/[ϓϩδΣΫτ໊]/IntermediateBuildFilesPath/[ϓϩδΣΫτ໊].build/ Release-iphoneos/[ϓϩδΣΫτ໊].build/Objects-normal/arm64
ϩάΛ͍ͬͯΔݶΓɺιʔεϑΝΠϧͷίϯύΠϧ࣌ؒʹ͕ࠩ ͋ΔΑ͏ʹݟ͑Δ👀
© ZOZO, Inc. 41 9DPEFͰͷṖڍಈ ϦϦʔεϏϧυͷܭଌ࣌ؒଌఆத Obj-CϑΝΠϧͷίϯύΠϧ ػ࣌ؒ(Ṗ) 12ඵ
Obj-CͷίϯύΠϧ SwiftͷίϯύΠϧ 3ඵ 140ඵ 12ඵ 3ඵ 4ඵ Ϗϧυͷ͍ਓ Ϗϧυͷ͍ਓ
© ZOZO, Inc. 42 9DPEFͰͷṖڍಈ ղܾํ๏ ɾXcode13.2.1ͷ࠶μϯϩʔυ ɾXcode13.3.0ͰϏϧυͯ͠ΈͨΒɺSwiftϑΝΠϧͷίϯύΠϧ͔ΒObj-Cͷ ίϯύΠϧͰͷػ͕࣌ؒ1ඵະຬʹͳ͍ͬͯͨͷͰɺXcode13.2.1ͷόάʁ
© ZOZO, Inc. 43 ࠓޙͷల © ZOZO, Inc.
© ZOZO, Inc. 44 ࠓޙͷల 3PTFUUB͔Βͷ٫ʂ ɾRosettaىҼʹΑΔෆ۩߹͔Βͷղ์👋 ɾσόοάϏϧυͷ͕͘ͳΔͷͰɺߋͳΔ։ൃޮͷ্💪 ɾRosettaͷαϙʔτऴྃΛߴΈͷݟ🤘
→PowerPC͔ΒIntelҠߦͷࡍͷRosetta5ޙʹαϙʔτऴྃ
None