Slide 1

Slide 1 text

Apple siliconಋೖͷ΢ϥΨϫ ςοΫϒϩάʹ੝ΓࠐΊͳ͔ͬͨ࿩ɺެ։͠·͢ גࣜձࣾZOZO ZOZOTOWN։ൃຊ෦ ZOZOTOWNΞϓϦ෦ iOSϒϩοΫ খদ ޛ Copyright © ZOZO, Inc.

Slide 2

Slide 2 text

© ZOZO, Inc. খদ ޛ(@tosh_3) 2020೥ZOZOςΫϊϩδʔζ(ݱZOZO)ʹ৽ଔೖࣾɻ ZOZOTOWNͷiOSΞϓϦͷ։ൃʹैࣄɻ झຯ͸εϙʔπ؍ઓɻ 2 גࣜձࣾZOZO ZOZOTOWN։ൃຊ෦ ZOZOTOWNΞϓϦ෦ iOSϒϩοΫ

Slide 3

Slide 3 text

© ZOZO, Inc. 3 ςοΫϒϩά ZOZOTOWN iOSνʔϜɺApple siliconಋೖ͠·ͨ͠ https://techblog.zozo.com/entry/zozotown-ios-apple-silicon

Slide 4

Slide 4 text

© ZOZO, Inc. 4 ςοΫϒϩάͷ಺༰·ͱΊ © ZOZO, Inc.

Slide 5

Slide 5 text

© ZOZO, Inc. 5 ςοΫϒϩά಺༰·ͱΊ "QQMFTJMJDPOಋೖ͠·ͨ͠ ɾiOSνʔϜશһͷ୺຤ɺIntel Mac͔ΒM1 Pro΁ͱҠߦ͠·ͨ͠ ɾM1 MacBook AirΛݕূػͱͨ͜͠ͱͰɺೋ೔ؒͰͷҠߦΛՄೳʹ ɾZOZOTOWN iOS͸RosettaΛ࢖༻͢Δ͜ͱʹ͠·ͨ͠ ɾM1 MaxͰ͸ͳ͘M1 Proʹ͠·ͨ͠ ɾϏϧυ଎౓͕൒෼ʹͳΓ·ͨ͠

Slide 6

Slide 6 text

© ZOZO, Inc. 6 ςοΫϒϩά಺༰·ͱΊ *OUFM.BD͔Β"QQMFTJMJDPO΁ͷҠߦλΠϜϥΠϯ ݄ 88%$ʹͯ "QQMFTJMJDPOൃදɻ ։ൃऀ޲͚ʹ%5,഑෍ɻ ݄ ݕূػͱͯ͠ɺ ..BD#PPL"JSΛߪೖ ݄ ݄ ݄ .1SP.BYൃද .1SPߪೖ .1SP౸ண "QQMFTJMJDPOҠߦ

Slide 7

Slide 7 text

© ZOZO, Inc. 7 ςοΫϒϩά಺༰·ͱΊ ݕূػಋೖͷഎܠ ɾM1ͷൃදͷλΠϛϯάͰ͸࣌ظঘૣ ɾࠓޙग़ΔϓϩϞσϧʹඋ͑ͨ४උ

Slide 8

Slide 8 text

© ZOZO, Inc. 8 ςοΫϒϩά಺༰·ͱΊ ࠓճಋೖͨ͠୺຤ͷεϖοΫ ɾ10ίΞCPU M1 Pro ɾ32GBϢχϑΝΠυϝϞϦ ɾ1TB SSD →ෳ਺ͷXcodeΛ؅ཧ͢Δ͜ͱ͕͋ΔͷͰগ͠༨༟Λ

Slide 9

Slide 9 text

© ZOZO, Inc. 9 ςοΫϒϩά಺༰·ͱΊ .1SPΛબ୒ͨ͠ཧ༝ ɾ10ίΞCPUͷProͱMaxͷେ͖ͳҧ͍͸GPUίΞ ɾࠓ·Ͱͷ։ൃͰϝϞϦෆ଍Λײ͡Δ͜ͱ͕ͳ͔ͬͨ ɹݕূػ(16GB)Ͱ΋໰୊ͳ͠ V.S. →࣮ࡍʹӡ༻͍ͯ͠ΔதͰ΋ɺշదʹ։ൃ͕Ͱ͖͍ͯΔ

Slide 10

Slide 10 text

© ZOZO, Inc. 10 ςοΫϒϩά಺༰·ͱΊ Ϗϧυ଎౓ͷมԽ ɾZOZOTOWNϦϦʔεϏϧυͷϏϧυ࣌ؒͰൺֱ ɾxcode-build-times-renderingΛ࢖༻ͯ͠ܭଌ ɾIntel Mac(Core i9)ͱApple silicon Mac(M1 Pro)Ͱൺֱ

Slide 11

Slide 11 text

© ZOZO, Inc. 11 ςοΫϒϩά಺༰·ͱΊ Ϗϧυ଎౓ͷมԽ ϦϦʔεϏϧυ Intel Core i9: 6෼25ඵ M1 Pro: 3෼12ඵ →Ϗϧυ͕࣌ؒ൒෼ʹʂ ෼

Slide 12

Slide 12 text

© ZOZO, Inc. 12 ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ © ZOZO, Inc.

Slide 13

Slide 13 text

© ZOZO, Inc. 13 ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ 3PTFUUBͱ͸Կ͔ʁ Rosettaͱ͸ARM64Ͱಈ͍͍ͯΔApple siliconԼʹ͓͍ͯɺx86_64༻ͷόΠ φϦΛಈ͔͢͜ͱͷͰ͖Δ຋༁ϓϩηε

Slide 14

Slide 14 text

© ZOZO, Inc. 14 ͳͥ3PTFUUBΛ࢖༻͢Δ͜ͱʹͨ͠ͷ͔ ֎ͨ͠ঢ়ଶͰϏϧυʹ͍࣋ͬͯ͘͜ͱ͕೉͔ͬͨ͠ɻ →Carthageܦ༝ͰೖΕ͍ͯΔϥΠϒϥϦΛ.frameworkܗ͔ࣜΒ.xcframework ܗࣜ΁ͱมߋ͠ͳ͍ͱ͍͚ͳ͍ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔

Slide 15

Slide 15 text

© ZOZO, Inc. 15 9$'SBNFXPSLͱ͸ Framework 📦 Universal Binary →ෳ਺ͷΞʔΩςΫνϟ༻ͷόΠφϦϑΝΠϧΛ·ͱΊͨ΋ͷɻ ͨͩ͠ɺಉҰͷΞʔΩςΫνϟΛෳ਺อ࣋Ͱ͖ͳ͍ iPhone༻ͷόΠφϦ(ARM64)ͱSimulator༻ͷόΠφϦ(x86_64) Λ·ͱΊΔ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ ⭕

Slide 16

Slide 16 text

© ZOZO, Inc. 16 9$'SBNFXPSLͱ͸ Framework 📦 Universal Binary →ෳ਺ͷΞʔΩςΫνϟ༻ͷόΠφϦϑΝΠϧΛ·ͱΊͨ΋ͷɻ ͨͩ͠ɺಉҰͷΞʔΩςΫνϟΛෳ਺อ࣋Ͱ͖ͳ͍ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ iPhone༻ͷόΠφϦ(ARM64)ͱSimulator༻ͷόΠφϦ(ARM64) Λ·ͱΊΔ ❌

Slide 17

Slide 17 text

© ZOZO, Inc. 17 9$'SBNFXPSLͱ͸ XCFramework ಉҰͷΞʔΩςΫνϟʹରͯ͠΋ෳ਺ͷόΠφϦΛ࣋ͭ͜ͱ͕Ͱ ͖Δܗࣜ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ iPhone༻ͷόΠφϦ(ARM64)ͱSimulator༻ͷόΠφϦ(ARM64) Λ·ͱΊΔ ⭕

Slide 18

Slide 18 text

© ZOZO, Inc. 18 ;0;0508/ͷϏϧυߏ੒ ZOZOTOWN Carthage CocoaPods ͦͷଞ ϥΠϒϥϦ ZOZOSUIT ZOZOMAT ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔

Slide 19

Slide 19 text

© ZOZO, Inc. 19 ;0;0508/ͷϏϧυߏ੒ Carthage CocoaPods ͦͷଞ ϥΠϒϥϦ ZOZOSUIT ZOZOMAT ZOZOTOWN ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ XCFramework

Slide 20

Slide 20 text

© ZOZO, Inc. 20 ;0;0508/ͷϏϧυߏ੒ Carthage CocoaPods ͦͷଞ ϥΠϒϥϦ ZOZOSUIT ZOZOMAT XCFramework ❌ ❌ ZOZOTOWN ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔

Slide 21

Slide 21 text

© ZOZO, Inc. 21 ;0;046*5Λ9$'SBNFXPSLԽ͢Δͷ͕೉͍͠ཧ༝ ɾOpenCVͷXCFrameworkαϙʔτঢ়گ ɾΫϩεϓϥοτϑΥʔϜͷίΞΞϧΰϦζϜͷϏϧυ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔

Slide 22

Slide 22 text

© ZOZO, Inc. 22 0QFO$7ͷ9$'SBNFXPSLαϙʔτঢ়گ ɾZOZOSUITͰ࢖༻͞Ε͍ͯΔOpenCVͷόʔδϣϯ͕3ܥ ɾOpenCVͰXCFrameworkରԠ͕͞Εͨͷ͸ɺ4.5.1Ҏ߱ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔

Slide 23

Slide 23 text

© ZOZO, Inc. 23 →3ܥͷόʔδϣϯͰ͋ͬͯ΋ɺࣗ෼ͰbuildઃఆΛௐ੔͢Δ͜ͱͰ XCFrameworkΛ࡞Δ͜ͱ͸Մೳ ɾZOZOSUITͰ࢖༻͞Ε͍ͯΔOpenCVͷόʔδϣϯ͕3ܥ ɾOpenCVͰXCFrameworkରԠ͕͞Εͨͷ͸ɺ4.5.1Ҏ߱ 0QFO$7ͷ9$'SBNFXPSLαϙʔτঢ়گ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔

Slide 24

Slide 24 text

© ZOZO, Inc. 24 ΫϩεϓϥοτϑΥʔϜͷίΞΞϧΰϦζϜͷϏϧυ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ XcodeͰ͸ͳ͘ɺϏϧυεΫϦϓτʹΑͬͯɺiOS΍AndroidͷͦΕͧΕͷ ΞʔΩςΫνϟ༻ͷ੩తϥΠϒϥϦΛੜ੒͍ͯ͠Δ

Slide 25

Slide 25 text

© ZOZO, Inc. 25 ΫϩεϓϥοτϑΥʔϜͷίΞΞϧΰϦζϜͷϏϧυ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔ XcodeͰ͸ͳ͘ɺϏϧυεΫϦϓτʹΑͬͯɺiOS΍AndroidͷͦΕͧΕͷ ΞʔΩςΫνϟ༻ͷ੩తϥΠϒϥϦΛੜ੒͍ͯ͠Δ XCFrameworkͷཁٻΛͨͩຬͨ͢ͷͰ͋Ε͹ɺiOS SimulatorΛ1ͭͷϓϥο τϑΥʔϜͱͯ͠෼ذΛ଍ͤ͹ྑ͍ ҰํͰɺ΍Γ͍ͨ͜ͱʹରͯ͠Өڹൣғ͕େ͖͗͢Δ͔΋͠Εͳ͍

Slide 26

Slide 26 text

© ZOZO, Inc. 26 ΫϩεϓϥοτϑΥʔϜͷίΞΞϧΰϦζϜͷϏϧυ ɾࣗ෼ୡͷνʔϜ಺Ͱ׬݁͢Δ΄Ͳখ͞ͳ໰୊Ͱ͸ͳ͔ͬͨ ɾXCFrameworkͷͨΊͷվमΛখखઌͰ΍ΔΑΓ΋ɺํ๏Λݕ౼͢Δ࣌ؒΛ ͱͬͨ΄͏͕ɺಘࡦ →ࠓճͷλΠϛϯάͰ͸ɺRosettaΛ࢖༻ͯ͠ͷҠߦ Rosetta͋ΓͰ͋ͬͯ΋ɺApple siliconಋೖʹΑͬͯ ಘΒΕΔޮՌେʂ ͳͥ3PTFUUBΛ֎ͤͳ͔ͬͨͷ͔

Slide 27

Slide 27 text

© ZOZO, Inc. 27 3PTFUUBͱͷ޲͖߹͍ํ © ZOZO, Inc.

Slide 28

Slide 28 text

© ZOZO, Inc. 28 3PTFUUBͱͷ޲͖߹͍ํ 3PTFUUBͱͷ޲͖߹͍ํ ɾRosettaΛ֎͢͜ͱͰϏϧυ଎౓Λ΋ͬͱ଎͘Ͱ͖Δ ɾPlayground͕࢖༻Ͱ͖ͳ͘ͳΔ ɾSimulatorͰεΫϩʔϧͷ׳ੑ͕ޮ͔ͳ͘ͳΔ ɾΞϓϦέʔγϣϯ͝ͱͷRosettaͷ࢖༻༗ແΛܾΊΔ

Slide 29

Slide 29 text

© ZOZO, Inc. 29 3PTFUUBΛ֎͢͜ͱͰϏϧυ଎౓Λ΋ͬͱ଎͘Ͱ͖Δ ɾ࣮ػ(ARM64)ʹରͯ͠σόοάϏϧυΛߦ͏ ɾRosettaͰىಈͨ͠΋ͷͱRosettaͳ͠Ͱىಈͨ͠΋ͷͰϏϧυ࣌ؒΛൺֱ 3PTFUUBͱͷ޲͖߹͍ํ

Slide 30

Slide 30 text

© ZOZO, Inc. 30 Rosetta͋Γ: 2෼35ඵ Rosettaͳ͠: 1෼28ඵ ZOZOTOWNͷσόοάϏϧυͷ༷ࢠ 3PTFUUBΛ֎͢͜ͱͰϏϧυ଎౓Λ΋ͬͱ଎͘Ͱ͖Δ ෼ Intel Core i7: 3෼48ඵ 3PTFUUBͱͷ޲͖߹͍ํ

Slide 31

Slide 31 text

© ZOZO, Inc. 31 1MBZHSPVOE͕࢖༻Ͱ͖ͳ͘ͳΔ໰୊ ɾXcodeΛRosettaͰىಈ͍ͯ͠Δ৔߹ʹૺ۰ ɾRosettaͳ͠Ͱىಈ͢Ε͹໰୊ͳ͘ಈ͔͢͜ͱ͕Ͱ͖Δ 3PTFUUBͱͷ޲͖߹͍ํ

Slide 32

Slide 32 text

© ZOZO, Inc. 32 4JNVMBUPSͷ׳ੑ͕ޮ͔ͳ͘ͳΔ RosettaͰϏϧυͨ͠ZOZOTOWNΞϓϦ RosettaͰىಈͨ͠Simulator Rosettaͳ͠Ͱىಈͨ͠Simulator 3PTFUUBͱͷ޲͖߹͍ํ

Slide 33

Slide 33 text

© ZOZO, Inc. 33 RosettaͰϏϧυ͞Ε͍ͯͳ͍Ͱ͋Ζ͏MapΞϓϦ RosettaͰىಈͨ͠Simulator Rosettaͳ͠Ͱىಈͨ͠Simulator 4JNVMBUPSͷ׳ੑ͕ޮ͔ͳ͘ͳΔ 3PTFUUBͱͷ޲͖߹͍ํ

Slide 34

Slide 34 text

© ZOZO, Inc. 34 9DPEF 
 3PTFUUBͳ͠ 9DPEF 3PTFUUB͋Γ 4JNVMBUPS 3PTFUUBͳ͠ εΫϩʔϧͷ׳ੑ⭕ εΫϩʔϧͷ׳ੑ❌ 4JNVMBUPS 3PTFUUB͋Γ εΫϩʔϧͷ׳ੑ❌ εΫϩʔϧͷ׳ੑ⭕ *XcodeͱSimulatorͷRosettaͷΦϯΦϑ͸ࣗಈͰಉظ͞Εͳ͍ 4JNVMBUPSͷ׳ੑ͕ޮ͔ͳ͘ͳΔ https://developer.apple.com/forums/thread/668488 3PTFUUBͱͷ޲͖߹͍ํ

Slide 35

Slide 35 text

© ZOZO, Inc. 35 3PTFUUBΛ࢖༻͢Δ؀ڥͱ࢖༻͠ͳ͍؀ڥ ɾRosetta͋ΓͰӡ༻͍ͯ͠ΔΞϓϦ - Xcode - Simulator - Bundler(CocoaPods) ɾRosettaͳ͠Ͱӡ༻͍ͯ͠ΔΞϓϦ - Terminal - AppStore޲͚Ϗϧυͷ࡞੒ 3PTFUUBͱͷ޲͖߹͍ํ

Slide 36

Slide 36 text

© ZOZO, Inc. 36 $PDPB1PETʹ͍ͭͯ ɾGemͰೖΕͨCocoaPods͸FFIपΓͷΤϥʔͷͨΊɺApple siliconԼͰͷ ࣮ߦ͕೉͍͠ →arch -x86_64Λ಄ʹ͚ͭͯӡ༻ ɾHomebrewܦ༝ͰೖΕΔͱApple siliconԼͰ΋໰୊ͳ͘ಈ͘ →BundlerʹΑͬͯCocoaPodsͷόʔδϣϯΛݻఆ͍ͨ͠ͷͰɺ࢖༻͠ͳ͍ ɾͦ΋ͦ΋ZOZOTOWNͰ͸PodsϑΝΠϧ͸git؅ཧ͞Ε͍ͯΔͨΊɺinstall ΍update͞ΕΔ͜ͱ͕গͳ͍ 3PTFUUBͱͷ޲͖߹͍ํ

Slide 37

Slide 37 text

© ZOZO, Inc. 37 9DPEFͰͷṖڍಈ © ZOZO, Inc.

Slide 38

Slide 38 text

© ZOZO, Inc. 38 9DPEFͰͷṖڍಈ ϦϦʔεϏϧυͷܭଌ࣌ؒଌఆத νʔϜ಺ͷͱ͋Δਓ ໿290ඵ ໿430ඵ νʔϜ಺ͷଞͷϝϯόʔ

Slide 39

Slide 39 text

© ZOZO, Inc. 39 9DPEFͰͷṖڍಈ ϦϦʔεϏϧυͷܭଌ࣌ؒଌఆத MacͷεϖοΫɺOS͸Ұॹ
 ಛผͳXcodeͷઃఆ΋ͳ͠ νʔϜ಺ͷͱ͋Δਓ ໿290ඵ ໿430ඵ νʔϜ಺ͷଞͷϝϯόʔ ໿140ඵ

Slide 40

Slide 40 text

© ZOZO, Inc. 40 9DPEFͰͷṖڍಈ ϦϦʔεϏϧυͷܭଌ࣌ؒଌఆத ~/Library/Developer/Xcode/DerivedData/[Ϗϧυͷݻ༗ࣝผࢠ]/Build/Intermediates.noindex/ ArchiveIntermediates/[ϓϩδΣΫτ໊]/IntermediateBuildFilesPath/[ϓϩδΣΫτ໊].build/ Release-iphoneos/[ϓϩδΣΫτ໊].build/Objects-normal/arm64 ϩάΛ௥͍ͬͯΔݶΓɺιʔεϑΝΠϧͷίϯύΠϧ࣌ؒʹࠩ෼͕ ͋ΔΑ͏ʹݟ͑Δ👀

Slide 41

Slide 41 text

© ZOZO, Inc. 41 9DPEFͰͷṖڍಈ ϦϦʔεϏϧυͷܭଌ࣌ؒଌఆத Obj-CϑΝΠϧͷίϯύΠϧ ଴ػ࣌ؒ(Ṗ) 12ඵ Obj-CͷίϯύΠϧ SwiftͷίϯύΠϧ 3ඵ 140ඵ 12ඵ 3ඵ 4ඵ Ϗϧυͷ஗͍ਓ Ϗϧυͷ଎͍ਓ

Slide 42

Slide 42 text

© ZOZO, Inc. 42 9DPEFͰͷṖڍಈ ղܾํ๏ ɾXcode13.2.1ͷ࠶μ΢ϯϩʔυ ɾXcode13.3.0ͰϏϧυͯ͠ΈͨΒɺSwiftϑΝΠϧͷίϯύΠϧ͔ΒObj-Cͷ ίϯύΠϧͰͷ଴ػ͕࣌ؒ1ඵະຬʹͳ͍ͬͯͨͷͰɺXcode13.2.1ͷόάʁ

Slide 43

Slide 43 text

© ZOZO, Inc. 43 ࠓޙͷల๬ © ZOZO, Inc.

Slide 44

Slide 44 text

© ZOZO, Inc. 44 ࠓޙͷల๬ 3PTFUUB͔Βͷ୤٫ʂ ɾRosettaىҼʹΑΔෆ۩߹͔Βͷղ์👋 ɾσόοάϏϧυͷ଎౓͕଎͘ͳΔͷͰɺߋͳΔ։ൃޮ཰ͷ޲্💪 ɾRosettaͷαϙʔτऴྃΛߴΈͷݟ෺🤘 →PowerPC͔ΒIntelҠߦͷࡍͷRosetta͸໿5೥ޙʹ͸αϙʔτऴྃ

Slide 45

Slide 45 text

No content