Slide 1

Slide 1 text

"OESPJEʹ͓͚Δ ύϑΥʔϚϯενϡʔχϯά࣮ફ @neonankiti

Slide 2

Slide 2 text

גࣜձࣾFiNC Technologies — Mobile Engineer(Android/iOS/Flutter) ೆཬ༐ؾ @neonankiti #εϊϘʔ #όεέ #Ωϟϯϓ #௼Γ #GoldGym ࣗݾ঺հ

Slide 3

Slide 3 text

ύϑΥʔϚϯε՝୊ͷࢦఠ CTO ΞϓϦͷಈ࡞͓΋ͳ͍ʁ͸΍ͯ͘͠΍ɻ Θ͔Γ·ͨ͠ʂʂ σʔλফඅྔ΍͹͘ͳ͍ʁ௚ͯ͠΍ɻ ΊͬͪΌి஑৯ͬͯͳ͍ʂʁʂʁʂ

Slide 4

Slide 4 text

ͳΜ͔Θ͔ΒΜ͚Ͳɺ΍ͬͯΈΔ͔

Slide 5

Slide 5 text

νʔϜͷ࠶ฤ੒ Before After ػೳ1 ػೳ2 ػೳ3 ػೳ1 ػೳ2 ػೳ3 ڞ ௨ ج ൫

Slide 6

Slide 6 text

ڞ௨ج൫νʔϜര஀

Slide 7

Slide 7 text

ͳͥνʔϜΛ࠶ฤ੒ͨ͠ͷ͔ʁ νʔϜମ੍͸ػೳ(υϝΠϯ)୯Ґ →ػೳ୯ҐͰ͸੹೚͕ᐆດͳ໰୊͕ੜ͡Δ

Slide 8

Slide 8 text

۩ମతʹى͖ͨ໰୊ ɾݪҼͷΘ͔Γਏ͍Ϋϥογϡ ɾσʔλ௨৴ྔͷ૿Ճ ɾόοςϦʔফඅͷ૿Ճ ɾͳΜ͔΋ͬ͞Γͯ͠Δ

Slide 9

Slide 9 text

ڞ௨ج൫νʔϜͷൃ଍΁ ಛఆͷػೳʹґଘ͠ͳ͍໰୊Λվળ͠ ΞϓϦͷ඼࣭ΛߴΊΔ͜ͱ͕੹຿

Slide 10

Slide 10 text

RailsςοΩʔͳ࿩ ϚΠΫϩαʔϏεͷཁૉٕज़ͷ࿩ Ϛωδϝϯτͷ࿩ ΞϓϦύϑΥʔϚϯεվળͷલʹ

Slide 11

Slide 11 text

ΞϓϦύϑΥʔϚϯεͱ͸ʁ

Slide 12

Slide 12 text

ϢʔβʔମݧʹӨڹΛ༩͑Δཁૉ ɾΫϥογϡ ɾANR ɾσʔλϩʔυ ɾUI(Ξχϝʔγϣϯ) ɾόοςϦʔফඅ ɾσʔλ௨৴ྔ ΞϓϦύϑΥʔϚϯε

Slide 13

Slide 13 text

ϦϦʔεޙʹൃੜ͠΍͍͢ ݦࡏԽͷλΠϛϯά ϦϦʔε ςετ ʷ ύϑΥʔϚϯεѱԽ

Slide 14

Slide 14 text

ͳͥϦϦʔεޙʹൃੜ͠΍͍͢ͷ͔ʁ ςετͰͷ࠶ݱੑ͕೉͍͠ ɾຊ൪։ൃ2"؀ڥͷࠩҟ ɾ࣌ؒత੍໿Ͱػೳςετ͕ࠔ೉

Slide 15

Slide 15 text

ςετΑΓલͷϑϩʔͰରࡦ͢Δ ࣮૷࣌ʹՄೳͳݶΓࢭΊΔ ϦϦʔε ςετ ʷ ύϑΥʔϚϯεѱԽ ࣮૷

Slide 16

Slide 16 text

ΤϯδχΞ͕ग़དྷΔ͜ͱ ɾલఏͱͳΔ஌ࣝΛ͚ͭΔ ɾΞϯνύλʔϯΛ౿·ͳ͍࣮૷ ΞϓϦύϑΥʔϚϯεʹؔͯ͠

Slide 17

Slide 17 text

ຊ೔ͷτϐοΫ

Slide 18

Slide 18 text

ຊ೔࿩߲͢໨ ɾ6*ͷվળ ɾσʔλ௨৴ྔ ɾόοςϦʔফඅ ࠶ݱੑ͕೉͍߲͠໨

Slide 19

Slide 19 text

RailsςοΩʔͳ࿩ ϚΠΫϩαʔϏεͷཁૉٕज़ͷ࿩ Ϛωδϝϯτͷ࿩ ΞϓϦύϑΥʔϚϯενϡʔχϯά࣮ફ

Slide 20

Slide 20 text

ύϑΥʔϚϯενϡʔχϯά࣮ફ 6*ͷվળ σʔλ௨৴ྔ όοςϦʔফඅ

Slide 21

Slide 21 text

ɾ6*ͷΧΫπΩ UIͷ໰୊ ɾ$16 (16ʹෛ୲Λ༩͑Δॲཧ

Slide 22

Slide 22 text

ɾ6*ͷΧΫπΩ UIͷ໰୊ ɾ$16 (16ʹෛ୲Λ༩͑Δॲཧ

Slide 23

Slide 23 text

ͳͥ6*͸ΧΫπΫͷ͔ʁ

Slide 24

Slide 24 text

'SBNF3BUF͕௿͍

Slide 25

Slide 25 text

ɾFPS = Frame Per Secondsɻ ɾਓؒ͸ɺ60FPS͕࠷దͱײ͡Δ Frame Rateͱ͸ ɾ60FPS ≒ 16ms/frame ≒1ඵؒʹॲཧ͞ΕΔϑϨʔϜ਺(੩ࢭը໘)

Slide 26

Slide 26 text

'14ͷ࣮ݱ

Slide 27

Slide 27 text

ΞϓϦͷىಈ = Linuxϓϩηεͷىಈ શͯͷλεΫ͸ϝΠϯεϨου(UIεϨου)Ͱ࣮ߦ UI Drawing LameWork App Events UI Drawing UI Drawing Main Thread(UI Thread) PROCESS AndroidΞϓϦͷ࣮ߦϓϩηε ࢀߟ IUUQTXXXZPVUVCFDPNXBUDI W)92IVRG576MJTU1-R@V8#8R:U7*S';8S#;D#@XG98

Slide 28

Slide 28 text

NTGSBNFΛӽ͑ͯ͠·͏ →Frame͕Drop͞ΕΔ 16ms UI Drawing LameWork App Events UI Drawing UI Drawing Main Thread(UI Thread) PROCESS 16ms 16ms Drop Over 16ms 60FPSͷࣦഊ

Slide 29

Slide 29 text

ɾλεΫΛNTGSBNFʹ཈͑Δ 60FPSͷ࣮ݱํ๏ ɾλεΫΛ෼ࢄ͢Δ

Slide 30

Slide 30 text

ɾωοτϫʔΫॲཧ 16ms/frameΛΦʔόʔ͠΍͍͢λεΫ ɾ*0ॲཧ ˠϝΠϯεϨουͱผεϨουͰ࣮ߦ

Slide 31

Slide 31 text

1. εϨου(ҎޙϫʔΧʔεϨου)ͷੜ੒ 2. ϫʔΧʔεϨου্ͰλεΫ࣮ߦ 3. ݁ՌΛϝΠϯεϨου΁ Worker Thread Main Thread(UI Thread) Update some UI Prep some work Do some long work ϚϧνεϨοσΟϯά

Slide 32

Slide 32 text

ɾϝϞϦ؅ཧϦʔΫ ϚϧνεϨοσΟϯάͷҰൠతͳίετ ɾεϨουੜ੒ͷΦʔόʔϔου

Slide 33

Slide 33 text

εϨουΛ͍ͭੜ੒͠ɺഁغ͢Δ͔͸ඞܾͣΊΔ ɾView͔Βͷࢀর(Activity) -> LeakCanaryͷར༻ ϝϞϦ؅ཧ/ϦʔΫରԠ ɾMemory Profilerͷར༻

Slide 34

Slide 34 text

Memory Profiler 1. ώʔϓɺϝϞϦྔͷλΠϜϥΠϯ 2. ಛఆͷλΠϛϯάͰͷΞϩέʔτ͞ΕͨΦϒδΣΫτ 1 2 ࢀߟ IUUQTEFWFMPQFSBOESPJEDPNTUVEJPQSPpMFNFNPSZQSPpMFS IMKB

Slide 35

Slide 35 text

ɾCPU Profileͷར༻ εϨουੜ੒ͷΦʔόʔϔουରԠ ɾεϨουੜ੒͸Φʔόʔϔουίετ͕ߴ͍ ɾεϨουࣗମΛݮΒ͢(࠷େݸ਺͸CPUʹґଘ) ɾ࠶ར༻(RxJava͸ThreadPoolΛར༻) ࢀߟ IUUQTEFWFMPQFSBOESPJEDPNTUVEJPQSPpMFDQVQSPpMFS IMKB

Slide 36

Slide 36 text

ɾ6*ͷΧΫπΩ UIͷ໰୊ ɾ$16 (16ʹෛ୲Λ༩͑Δॲཧ

Slide 37

Slide 37 text

ϨϯμϦϯά

Slide 38

Slide 38 text

ɾը໘ͷσʔλ͸πϦʔߏ଄ AndroidϨϯμϦϯάͷಛ௃ ɾιϑτ΢ΣΞඳըͱϋʔυ΢ΣΞΞΫηϥϨʔγϣϯ Ҏޙ)8"

Slide 39

Slide 39 text

ɾτϥόʔαϧͳϓϩηεͷͨΊίετ͕ߴ͍ ϨϯμϦϯάͷίετ ɾ7JFXͷݺͼग़͠ ɾ਌͕ࢠΛଌఆ NFBTVSF 3PPU 7JFX 7JFX 7JFX 7JFX 7JFX 7JFX 7JFX ɾ࠶ؼత ɾSPPUͷαΠζ͕ܾఆ ɾը໘্ͷҐஔΛܾఆ MBZPVU ɾ༿ϊʔυͷҐஔ͕ܾఆ

Slide 40

Slide 40 text

ιϑτ΢ΣΞඳըͱHWA ɾ$16PS(16 ඳըํ๏ ιϑτ΢ΣΞඳը HWA Invalidate Canvas ผϨΠϠʔ શͯͷϊʔυʹӨڹ dirtyͷΈߋ৽

Slide 41

Slide 41 text

Πϝʔδ $BOWBT ιϑτ΢ΣΞඳը HWA →શߋ৽ →dirtyͷΈ $BOWBT ϋʔυ΢ΣΞ ϨΠϠʔ dirty

Slide 42

Slide 42 text

ɾਂ͍View֊૚ ɾιϑτ΢ΣΞඳըʹ͓͚ΔonDraw() ɾOverdrawingʹΑΔGPU࣌ؒͷফඅ ࣮૷্ͷ໰୊

Slide 43

Slide 43 text

Ұ୴πʔϧΛ࢖ͬͯΈΔ

Slide 44

Slide 44 text

ɾ։ൃऀΦϓγϣϯ ɹɾGPUϨϯμϦϯάͷϓϩϑΝΠϧ࡞੒ ɹɾGPUΦʔόʔυϩʔΛσόοά ɹɾGPUදࣔͷߋ৽Λදࣔ ϨϯμϦϯάͷσʔλղੳπʔϧ ɾLayoutInspector

Slide 45

Slide 45 text

ɾLayoutͷώΤϥϧΩʔΛRuntimeͰղੳ͢ΔͨΊͷπʔ ϧɻxmlɺ·ͨ͸ಈతੜ੒ͨ͠ViewͳͲͷ֊૚ߏ଄͕Θ͔Β ͳ͍ࡍʹར༻͢Δɻ ɾTools -> LayoutInspector͔Β࣮ߦͰ͖Δ ɾproject_root/capturesʹRuntimeͷεφοϓγϣοτ͕อଘ͞ΕΔ LayoutInspector

Slide 46

Slide 46 text

όʔδϣϯ؅ཧ(6*࣮૷ߏ଄ϓϩύςΟ Captureͷ੾Γସ͑ Viewߏ଄ ※) staging؀ڥͷͨΊdebug tool view͕දࣔ͞Ε͍ͯΔ ViewϓϩύςΟ αϯϓϧ

Slide 47

Slide 47 text

ɾGPUϨϯμϦϯάͷϓϩϑΝΠϧ࡞੒ ɾGPUϨϯμϦϯάͷϓϩηεຖͷίετ ɾGPUΦʔόʔυϩʔΛσόοά ɾGPUϨϯμϦϯάͷOverdraw ɾGPUදࣔͷߋ৽Λදࣔ ɾGPUϨϯμϦϯάߋ৽৔ॴͷಛఆ ։ൃऀΦϓγϣϯ

Slide 48

Slide 48 text

։ൃऀΦϓγϣϯ GPUϓϩϑΝΠϧ GPUΦʔόʔυϩʔ - ࢵɺԫ྘ͷΤϦΞ GPUදࣔͷߋ৽ - ੺͍ਖ਼ํܗ 16msϥΠϯ 1frame αϯϓϧ

Slide 49

Slide 49 text

'J/$ΞϓϦʹࢼͯ͠ΈΔ

Slide 50

Slide 50 text

'J/$ΞϓϦͷར༻ස౓͕ߴ͍ը໘Ͱଌఆ ɾ੺͍৭͸Overdrawճ਺͕4ճΛ௒͑Δ΋ͷɻ ɾఆظ࣮ߦΞχϝʔγϣϯ͕૸Δ౓ʹɺGPU Profilerͷ੺ ͍όʔ͕௓Ͷ্͕Δ ɾఆظ࣮ߦΞχϝʔγϣϯΛࢭΊͯ΋ɺͳ͔ͥ਺ඵຖʹը ໘ͷ΢Οϯυ΢͕఺໓͠ɺΞοϓσʔτ͕૸ͬͯ͠·͏ɻ ɾGPU Profilerͷ੨͍όʔ͕େ͖͍ɻ ϨϯμϦϯάύϑΥʔϚϯεଌఆ

Slide 51

Slide 51 text

ύϑΥʔϚϯεͷج४Λઃஔ͢Δ ج४Λઃఆ͢Δ ɾແବͳվળΛ͠ͳ͍ͨΊ ɾఆྔత͕೉͚͠Ε͹ɺج४Λ࡞Δ ɾߴ඼࣭ΞϓϦ ɾಉػೳΞϓϦ

Slide 52

Slide 52 text

*OTUBHSBNͱͷൺֱ ՄೳͳݶΓಉ৚݅ ɾ੺͍όʔ͸ಉ͡ఔ౓ ɾ੨͍όʔ͕શମతʹߴ͍ɻ ɾશମతʹOverdraw͕গͳ͍ɻ ɹɾView֊૚͕গͳ͍ ɹɾແବͳΞϧϑΝ͕ͳ͍ ɹɾద੾ͳΫϦοϐϯάॲཧ ߴ඼࣭ΞϓϦͱͷൺֱ

Slide 53

Slide 53 text

ɾOverdraw RecyclerViewͷitemViewͷ༨෼ͳView֊૚ ɾGPU Profiler ɾ੨͍όʔ͕େ͖͍ = onDraw()ͷDisplayListੜ੒ͷίετɻ onDraw()ͷස౓ɺoff-screenͷϨϯμϦϯάɺonDraw()ͷॲཧ͕ॏ͍ ɾGPUඳըͷߋ৽ ɾఆظ࣮ߦΞχϝʔγϣϯͷίετ ɹɾFiNCͪΌΜ(ΞΠίϯ) ۩ମతͳ໰୊఺

Slide 54

Slide 54 text

ɾෆཁͳbackgroundͷ࡟আ Overdraw΁ͷରԠ ɾਂ͍ViewΛઙ͘͢Δ

Slide 55

Slide 55 text

Viewίϯςφʹແବͳ֊૚͸ͳ͍͔ʁ ෆཁͳbackgroundͷ࡟আ TextView FrameLayout RecyclerView

Slide 56

Slide 56 text

ɾxml্ͰແବͳViewίϯςφΛ࡞Βͳ͍ ਂ͍ViewΛઙ͘͢Δ ɾಈతʹ௥Ճ͢Δ৔߹Ͱ΋ɺmergeΛݕ౼ ɾConstraintLayoutΛར༻͢Δ

Slide 57

Slide 57 text

վળ݁Ռ վળલ վળޙ

Slide 58

Slide 58 text

ɾPO%SBX಺ͰͷϝϞϦΞϩέʔτېࢭ GPUϨϯμϦϯά΁ͷରԠ ɾPO%SBX಺ͰͷMPPQॲཧͷվળ ɾPGGTDSFFOϨϯμϦϯάͷఀࢭ

Slide 59

Slide 59 text

PO%SBX͸ίετ͕ߴ͍ ɾෆมΦϒδΣΫτ͸ɺελοΫྖҬʹల։͢Δ Before onDraw಺ͰͷϝϞϦΞϩέʔτېࢭ ɾGC͕ߴ͍ස౓Ͱ૸ͬͯ͠·͏ After

Slide 60

Slide 60 text

MPPQͷ$BOWBTૢ࡞͸ίετ͕ߴ͍ ɾGPUϨϯμϦϯά͸GPU΁ͷΦϒδΣΫτΛੜ੒͢Δ onDraw಺Ͱͷloopॲཧͷվળ ɾCanvas#drawLineͰloopͰ͸ͳ͘ɺCanvas#drawLinesΛ࢖͏

Slide 61

Slide 61 text

PGGεΫϦʔϯ࣌ͷॲཧΛࢭΊΔ off-screenͷϨϯμϦϯάͷېࢭ ɾBVUPTMJEF͕ద༻ ɾλϒ ΧελϜ7JFX1BHFS Ҡಈ࣌ʹࢭΊΔ ɾWJTJCMF6TFS)JOU

Slide 62

Slide 62 text

ఆظ࣮ߦΞχϝʔγϣϯͷ࣮ߦ GPUඳըͷߋ৽ ˠΧελϜϏϡʔͷ)8"Λ༗ޮʹ

Slide 63

Slide 63 text

ɾ6*ͷجૅΛֶͼɺΞϯνύλʔϯΛ౿·ͳ͍ UIվળͷ·ͱΊ ɾ5PPMΛద੾ʹ࢖͍ɺύϑΥʔϚϯεΛվળ

Slide 64

Slide 64 text

6*ͷվળ σʔλ௨৴ྔ όοςϦʔফඅ ύϑΥʔϚϯενϡʔχϯά࣮ફ

Slide 65

Slide 65 text

Ωϟογϡͷར༻ σʔλ௨৴ྔΛ࡟ݮ͢ΔͨΊʹ ωοτϫʔΫ Packet Packet Packet ը૾σʔλͷ࡟ݮ ม׵ γϦΞϥΠθʔγϣϯ

Slide 66

Slide 66 text

Ωϟογϡͷར༻

Slide 67

Slide 67 text

ϝϞϦ Ωϟογϡͱ͸ʁ σʔλͷϩʔυΛߴ଎Խ͢ΔͨΊͷ࢓૊Έ σΟεΫ

Slide 68

Slide 68 text

Ϣʔεέʔεʹ߹Θͤͯ࢖͏ σʔλอ࣋ظؒ ϝϞϦΩϟογϡ σΟεΫΩϟογϡ ࣮ߦεϨου ΞϓϦϓϩηε Πϯετʔϧத ͲͷεϨουͰ΋ྑ͍ ϫʔΧʔεϨου อଘྖҬ গͳ͍ ଟ͍ ϝϞϦ vs σΟεΫΩϟογϡ

Slide 69

Slide 69 text

ɾϝϞϦΩϟογϡ༻ͷAndroidఏڙΫϥε →࢖༻ՄೳϝϞϦ্ݶͷνΣοΫ →্ه͔ΒLruCacheͷར༻ՄೳϝϞϦྔΛׂΓ౰ͯ ࢀߟ) https://developer.android.com/topic/performance/graphics/cache-bitmap ɾ࢖༻ස౓͕௿͍σʔλΛ࡟আ͍ͯ͘͠ LruCacheΛ༻͍ͨϝϞϦΩϟογϡ

Slide 70

Slide 70 text

ɾσΟεΫ: ετϨʔδͷ2%ΛׂΓ౰ͯ (5MBʙ50MBͷൣғ಺) ࢀߟ) https://github.com/square/picasso/blob/master/picasso/src/main/java/com/squareup/picasso3/Utils.java#L163-L182 ɾsquareࣾͷը૾ϩʔυ&ΩϟογϡͷϥΠϒϥϦ ࢀߟ) https://github.com/JakeWharton/picasso2-okhttp3-downloader/blob/master/src/main/java/com/jakewharton/picasso/OkHttp3Downloader.java ɾΧελϜΩϟογϡ(Okhttp3) ɾϝϞϦ: ώʔϓྖҬͷ15%ΛׂΓ౰ͯ ࢀߟ) https://github.com/square/picasso/blob/master/picasso/src/main/java/com/squareup/picasso3/Utils.java#L184-L190 PicassoΛ༻͍ͨϝϞϦ/σΟεΫΩϟογϡ

Slide 71

Slide 71 text

Ωϟογϡ͸ೋछྨ͋ΓɺϝϞϦ͸شൃੑɺσΟε Ϋ͸ෆشൃੑ Ωϟογϡ͸σʔλ΁ͷΞΫηεΛߴ଎Խ͢Δ Ωϟογϡར༻ͷ·ͱΊ →σʔλϩʔυͷͨΊͷωοτϫʔΫॲཧճ਺͕ݮ গ͠ɺύϑΥʔϚϯε͕޲্͢Δɻ

Slide 72

Slide 72 text

Ωϟογϡͷར༻ σʔλ௨৴ྔΛ࡟ݮ͢ΔͨΊʹ ωοτϫʔΫ Packet Packet Packet ը૾σʔλͷ࡟ݮ ม׵ γϦΞϥΠθʔγϣϯ

Slide 73

Slide 73 text

γϦΞϥΠθʔγϣϯ

Slide 74

Slide 74 text

ྫ) ɾAPI௨৴ͰͷKotlin 㲗 JSON ɾΩϟογϡ࣌ͷϑΝΠϧॻ͖ࠐΈ ௚ྻԽͷ͜ͱɻಛఆͷ؀ڥʹґଘͨ͠ΦϒδΣΫτ ΛόΠτྻʹม׵͢Δ͜ͱ γϦΞϥΠθʔγϣϯͱ͸ʁ ม׵

Slide 75

Slide 75 text

γϦΞϥΠθʔγϣϯͷύϑΥʔϚϯε ϝϦοτ ςΩετ(JSON, XML) όΠφϦʔܗࣜ Մಡੑ͕ߴ͍ σϝϦοτ ແବͳσʔλ͕ଟ͍ σʔλྔ͕গͳ͍ Մಡੑ͕௿͍ ςΩετ vs όΠφϦʔ

Slide 76

Slide 76 text

+40/ͰͷςΩετܗࣜ ɾςΩετϕʔεͷܗࣜ͸৑௕Ͱσʔλྔ͕ଟ͘ͳΔ { “id”: 0, “name”: “bison”, “image”: “https://bisonworks/bisons/1/image” } ۭന Ϧλʔϯ ࢀর JSON

Slide 77

Slide 77 text

ɾprotoϑΝΠϧΛఆٛ →ίϯύΠϧ →ݴޠ͝ͱͷߏ଄ମͷੜ੒ ɾόΠφϦܗࣜͰγϦΞϥΠζ͞ΕΔɻ ɾෳ਺ݴޠؒͰͷҰ؏ੑΛอͯΔ ɾprotoϑΝΠϧ͸Մಡੑ΋ߴ͍ message Animal { required string name = 1; required int32 id = 2; optional string image =3; } Protocol Buffers

Slide 78

Slide 78 text

ɾςΩετܗࣜ(JSON, XML)͸Մಡੑ͸ߴ͍͕ɺσʔλྔ͸ଟ͍ ɾόΠφϦʔܗࣜ͸Մಡੑ͸௿͍͕ɺσʔλྔ͸গͳ͍ɻ ɾProtocol Buffers͸DSLͷΑ͏ͳ΋ͷͰɺՄಡੑ͕ߴ͘ɺ ͔ͭૹड৴࣌ͷγϦΞϥΠζ͞Εͨσʔλྔ΋গͳ͍ γϦΞϥΠθʔγϣϯͷ·ͱΊ →Protocol BufferͰՄಡੑߴ͘ɺσʔλྔ͕গͳ͍γϦ ΞϥΠζΛߦ͏

Slide 79

Slide 79 text

Ωϟογϡͷར༻ σʔλ௨৴ྔΛ࡟ݮ͢ΔͨΊʹ ωοτϫʔΫ Packet Packet Packet ը૾σʔλͷ࡟ݮ ม׵ γϦΞϥΠθʔγϣϯ

Slide 80

Slide 80 text

ը૾σʔλͷ࡟ݮ

Slide 81

Slide 81 text

ը૾ϑΥʔϚοτʹؔͯ͠ ը૾ͷϑΥʔϚοτʹ஫ҙ͢Δ ɾσʔλྔ͕ஶ͘͠มΘΔ ɾը૾ͷΫΦϦςΟ͕มΘΔ

Slide 82

Slide 82 text

ը૾ϑΥʔϚοτνʔτγʔτ ࢀߟ IUUQTEFWFMPQFSBOESPJEDPNUPQJDQFSGPSNBODFOFUXPSLYGFS

Slide 83

Slide 83 text

WebPͷύϑΥʔϚϯε Մٯѹॖͷ৔߹ɺPNGΑΓ26%খ͍͞ ෆՄٯѹॖͷ৔߹ɺJPEGΑΓ25-34%খ͍͞ ࢀߟ IUUQTEFWFMPQFSTHPPHMFDPNTQFFEXFCQ

Slide 84

Slide 84 text

WebPҎ֎ͷ৔߹ PNG͔JPEG͔

Slide 85

Slide 85 text

PNGͱJPEG PNG JPEG ɾಁաʹରԠ ɾՄٯѹॖ ɾෆՄٯѹॖ

Slide 86

Slide 86 text

Ϣʔεέʔε PNG JPEG ɾγϯϓϧͳը૾ ɾෳࡶͳը૾ Α͘ݴΘΕΔը૾ͷ࢖͍෼͚

Slide 87

Slide 87 text

γϯϓϧͳը૾ͷఆٛͱ͸

Slide 88

Slide 88 text

γϯϓϧͳը૾ PNG JPEG ɾෳࡶͳۂઢ͕ଘࡏ͠ͳ͍ܗ ɾ৭ͷόϦΤʔγϣϯ͕গͳ͍ ɾෳ਺ͷ৭ͷόϦΤʔγϣϯ ɾෳࡶͳۂઢ

Slide 89

Slide 89 text

ͳ͔ͥʁ

Slide 90

Slide 90 text

PNGѹॖͷΞϧΰϦζϜ(Indexed Format) RGBΛࢀর͢Δܗʹมߋ͢Δ ɾը૾͸ϐΫηϧ͝ͱʹRGB৘ใΛ࣋ͭ ɾ8bit(256֊ௐ) * 3 = 24bit = 2^24 ≒ 1600ສ৭ ɾϐΫηϧ͕࣋ͭ৘ใ͸IndexͷΈ ɾΧϥʔύϨοτΛ࣋ͭ(্ݶΛઃ͚Δ)

Slide 91

Slide 91 text

୯ҐϐΫηϧͷ৘ใྔ͕ܹݮ͢Δ ύϨοτ਺͸2,4,16,256͕ࢦఆͰ͖Δ ɾ1byteͰදݱͰ͖Δ 24bit = 3bytes 1byte

Slide 92

Slide 92 text

JPEGͷΞϧΰϦζϜ 8ϐΫηϧ͝ͱͷϒϩοΫʹ෼͚ͯॲཧ ϒϩοΫ಺Ͱ৘ใΛϑΟϧλϦϯά͢Δ

Slide 93

Slide 93 text

௚ઢతͳڥքʹऑ͍ ڥք͕ΑΓ௚ઢͩͱը࣭͕ѱ͘ͳΔ 8pixel

Slide 94

Slide 94 text

໨ࢹνΣοΫ ਓؒͷ໨͸͍͍Ճݮ ໨ࢹνΣοΫͰσʔλྔͷ࡟ݮΛʂ

Slide 95

Slide 95 text

ը૾σʔλ࡟ݮͷ·ͱΊ WebPରԠ͍ͯ͠Ε͹WebPͷҰ୒ JPEGɺPNGͷσʔλྔΛཧղ͢Δɻ ͦͷ্Ͱ࣮ࡍͷ໨Ͱ֬ೝͯ͠ѹॖ͢Δɻ

Slide 96

Slide 96 text

6*ͷվળ σʔλ௨৴ྔ όοςϦʔফඅ ύϑΥʔϚϯενϡʔχϯά࣮ફ

Slide 97

Slide 97 text

ɾϓϩηοα(ϋʔυ)Ͱిྲྀ͕ྲྀΕΔ ɾOS(ιϑτ)͕CPUͷϞʔυมߋΛߦ͏ → CPUϞʔυΛ௿͘อͭ όοςϦʔফඅΛ࡟ݮ͢ΔͨΊʹ

Slide 98

Slide 98 text

$16͸ిྗΛޮ཰తʹ࢖͓͏ͱ͢Δ CPUʹ͸Ϟʔυ͕͋Δ

Slide 99

Slide 99 text

࣍ͷॲཧʹඋ͑Δ,FFQ"XBLFͷίετ ϞόΠϧ௨৴࣌ͷফඅిྗ

Slide 100

Slide 100 text

ϞόΠϧ௨৴Λࡉ੾Εʹͨ͘͠ͳ͍

Slide 101

Slide 101 text

όονॲཧͱ͸ʁ ෼ࢄͨ͠λεΫΛಉ࣌ʹ࣮ߦ͢Δ͜ͱɻΦʔόʔϔουΛݮগͤ͞Δɻ Task Before After Executed Task Executed Task Executed Task Task Task Executed 1 1 1 1 ϞόΠϧ௨৴࣌ͷফඅిྗ

Slide 102

Slide 102 text

αʔόʔͱͷσʔλͷಉظੑ͕ݫີͰͳ͍΋ͷ ࠷ѱɺσʔλ͕ࣦΘΕͯ΋໰୊͕ͳ͍΋ͷ ෼ੳϩάσʔλ ఆظతͳσʔλͷಉظ ϞόΠϧʹ͓͚Δόονॲཧ

Slide 103

Slide 103 text

ɾJobSchedulerͱAlertManagerΛOSόʔδϣϯͰ࢖͍෼͚ ɾෳ਺λεΫͷνΣΠϯ ɾδϣϒʹ੍ݶΛ͚ͭΒΕΔ ɾόοςϦʔফඅ/ωοτϫʔΫঢ়ଶ/ॆిঢ়ଶ/CPUͷঢ়ଶ/ετϨʔδͷۭ͖ ɾ஗ԆͰ͖Δ(Deferrable)ఆظత/ϫϯλΠϜͳδϣϒʹ࢖͏ WorkManager ɾόοΫΦϑ(ࢦ਺ؔ਺తස౓)αϙʔτ

Slide 104

Slide 104 text

ϘτϧωοΫΛ୳Γ͍ͨ

Slide 105

Slide 105 text

#BUUFSZ)JTUPSJBO ୺຤ͷόοςϦʔফඅྔΛՄࢹԽग़དྷΔπʔϧ 1. OverViewͷάϥϑ ɾ߲໨ΛϐοΫͨ͠ΧελϜάϥϑ΋Ͱ͖Δ 2. App Selection ɾΞϓϦ/߲໨ͰϑΟϧλՄೳ 3. Tables ɾΞϓϦؒൺֱ/ώετϦʔ(ྦྷੵσʔλ)/ΞϓϦελοπ 4. ݁Ռ ɾϑΟϧλ݁ՌΛදࣔ͢Δ σʔλղੳπʔϧ

Slide 106

Slide 106 text

ɾ୺຤ͷి஑ফඅྔΛՄࢹԽग़དྷΔπʔϧ ɾDocker্Ͱಈ͘(Α͏ʹͳͬͯΔʂ) 1. OverViewͷάϥϑ 2. App Selection 3. Tables 4. ݁Ռ Battery Historianͷશମతͳߏ੒

Slide 107

Slide 107 text

ɾެࣜ: https://github.com/google/battery-historian EPDLFSSVOQQPSUHDSJPBOESPJECBUUFSZIJTUPSJBOTUBCMFQPSU ɾ͸ԿͰ΋Α͍ɻ9999ͱ͔ʹ͓ͯ͘͠ IUUQMPDBMIPTUQPSU ɾAndroid୺຤಺ʹbugreportsͷdir͕͋Δ adb bugreport bugreport.zip ※) ެࣜͷͰΤϥʔ͕ग़Δਓ͸ී௨ʹabdͰϑΝΠϧసૹ͍ͯͩ͘͠͞ɻ ؀ڥߏங

Slide 108

Slide 108 text

Battery Level͸1ࠁΈͳͷͰɺ୹͍෦෼͕ফඅిྗ͕ߴ͍෦෼ όοςϦʔͷղੳํ๏

Slide 109

Slide 109 text

CPUͷϞʔυ ϞόΠϧ௨৴͸ίετ͕ߴ͍ όοςϦʔͷղੳํ๏

Slide 110

Slide 110 text

ܧଓతଌఆ͕೉͍͠

Slide 111

Slide 111 text

ܦݧ্ɺٙͬͯΈΔͱྑͦ͞͏ͳ͜ͱ όοΫάϥ΢ϯυͰఆظతͳॲཧΛ࣮ߦ͍ͯ͠Δ ը໘্Ͱଟ͘ͷωοτϫʔΫॲཧΛߦ͍ͬͯΔλεΫ ఆੑతʹ΋Ξϓϩʔν͢Δ ɾස౓ɺॏ͍ॲཧ ɾෆద੾ͳϥΠϑαΠΫϧ(onResumeͳͲ)Ͱͷίʔϧ

Slide 112

Slide 112 text

CPUͷϞʔυ(awake, sleep)ΛSleep΁ ϞόΠϧ௨৴͸஗ԆΛݕ౼͢Δ ఆྔͱఆੑతͳ྆໘͔ΒΞϓϩʔν͢Δ όοςϦʔফඅͷ࠷దԽ·ͱΊ

Slide 113

Slide 113 text

RailsςοΩʔͳ࿩ ϚΠΫϩαʔϏεͷཁૉٕज़ͷ࿩ Ϛωδϝϯτͷ࿩ શମతͳ·ͱΊ

Slide 114

Slide 114 text

શମతͳ·ͱΊ ࠶ݱੑ͕௿͍ύϑΥʔϚϯε໰୊ʹରॲ͢Δ ύϑΥʔϚϯεͷલఏ஌ࣝΛ͚ͭɺఆੑͱఆྔͱͷ ྆ྠ͔ΒΞϓϩʔν͍ͯ͘͠