Upgrade to Pro — share decks privately, control downloads, hide ads and more …

APIのデータのマッピングを 約18倍速くした話

magiepooh
February 22, 2018

APIのデータのマッピングを 約18倍速くした話

magiepooh

February 22, 2018
Tweet

More Decks by magiepooh

Other Decks in Technology

Transcript

  1. ঢ়گ • Wi-Fi઀ଓ؀ڥ • σʔλ͸JSONܗࣜ • αΠζ͸1MB • Kotlin +

    Moshi(=A modern JSON library for Android and Java)
  2. ରࡦ1ɿMoshi͕ѱ͍ͷͰ͸ʁ • moshi(moshi-kotlin: Square੡JSONύʔα)͸ϦϑϨΫγϣϯ Λ༻͍͍ͯΔͨΊɺίετ͕ߴ͍ • KotshiΛ࢖͏ • An annotations

    processor that generates Moshi adapters from immutable Kotlin data classes. • https://github.com/ansman/kotshi
  3. ରࡦ1ɿMoshi͕ѱ͍ͷͰ͸ʁ • moshi(moshi-kotlin: Square੡JSONύʔα)͸ϦϑϨΫγϣϯ Λ༻͍͍ͯΔͨΊɺίετ͕ߴ͍ • KotshiΛ࢖͏ • An annotations

    processor that generates Moshi adapters from immutable Kotlin data classes. • https://github.com/ansman/kotshi => 20sec -> 12sec
  4. ରࡦ2ɿΦϒδΣΫτੜ੒͕ଟ͗͢Δ໰୊ • ഑ྻͷதʹΦϒδΣΫτ͕େྔʹଘࡏ͍ͯͨ͠ => ΦϒδΣΫτ͡Όͳ͘ɺStringܕͷ഑ྻͷ഑ྻͰදݱ͢Δ { “hogeArray”: [ {“obj”: {123,

    456.2}},… ] } { “hogeArray”: [ [“123”, “456.2”],… ] } => 12sec -> 8.4secʢ഑ྻσʔλ͕ͦ΋ͦ΋ڊ େͩͬͨͨΊɺ͔ͳΓ͕ࠩग़ͨʣ
  5. ·ͱΊ2 • iOSͰ͸ͦ͜·Ͱύʔεʹ͕͔͔࣌ؒͬͯͳ͔ͬͨͷ͕ٙ໰ • ΋͔ͯ͠͠ݹ͍୺຤ͩͱ͕͔͔࣌ؒΔʁ • ը໘ભҠΞχϝʔγϣϯ(Shared Element Transition)͕͋Δͱɺ 2.9secͰ΋஗͘ײ͡ͳ͍

    • ͦΕͰ΋ɺ2.9sec͔͔Δͷ͕ݏͩͬͨͷͰɺେྔͷ഑ྻͷऔಘ͸ ผAPIʹ੾Γग़ͨ͠ɻʢͦΕͰ1.2sec͘Β͍·ͰॖΊͯ18ഒͷύ ϑΥʔϚϯεվળୡ੒ɾɾʣ