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
APIのデータのマッピングを 約18倍速くした話
Search
magiepooh
February 22, 2018
Technology
2
930
APIのデータのマッピングを 約18倍速くした話
magiepooh
February 22, 2018
Tweet
Share
More Decks by magiepooh
See All by magiepooh
今さら角丸のTransition
magiepooh
0
1.1k
Google I/O Extended Tokyo 2018
magiepooh
2
1.5k
まだAPI定義管理で消耗してるの?〜Swaggerを用いた大規模アプリ時代のAPI定義管理とコードジェネレート〜
magiepooh
38
18k
RootBeer
magiepooh
0
770
Customize Error Message
magiepooh
0
760
Kotlin入門
magiepooh
2
1.7k
Adjust Full Screen
magiepooh
2
470
How to get size of NavigationBar and StatusBar
magiepooh
1
1.6k
How to detect phone call
magiepooh
0
1.6k
Other Decks in Technology
See All in Technology
CData Virtuality 日本ローンチイベントのKeynote
cdataj
0
230
テストコードの品質を客観的な数値で担保しよう〜Mutation Testのすすめ〜
ysknsid25
12
3.2k
YAPC::Hakodateの映像記録を支える技術
godan
4
230
【shownet.conf_】革新と伝統を融合したファシリティ
shownet
PRO
0
340
LINEヤフー新卒採用 コーディングテスト解説 アルゴリズム問題編
lycorp_recruit_jp
0
13k
LINEヤフー新卒採用 コーディングテスト解説 実装問題編
lycorp_recruit_jp
1
12k
ドキュメントとの付き合い方を考える
leveragestech
1
140
kube-vipとkube-proxy置き換えCiliumを積んだ究極のK3sクラスタを建てる
logica0419
4
210
軽いノリで"自動化"に取り組んではいけないという話
tetsuyaooooo
1
500
ゼロから実装まで!機械学習入門
natsuki0726
0
180
【インフラエンジニアbooks】30分でわかる「AWS継続的セキュリティ実践ガイド」
hssh2_bin
4
1.7k
Product Utilization of Large Language Models Starting Today
ymatsuwitter
3
1.4k
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
In The Pink: A Labor of Love
frogandcode
139
22k
From Idea to $5000 a Month in 5 Months
shpigford
381
46k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
A Modern Web Designer's Workflow
chriscoyier
692
190k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Facilitating Awesome Meetings
lara
49
6k
Code Reviewing Like a Champion
maltzj
519
39k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
231
17k
No one is an island. Learnings from fostering a developers community.
thoeni
19
2.9k
Transcript
APIͷσʔλͷϚοϐϯάΛ 18ഒͨ͘͠ potatotips #48 @magie_pooh
ࣗݾհ ౻ాୖຏ @magie_pooh @magiepooh झຯɾಛٕ: ΫϥϑτϏʔϧɾຊञɾϚδοΫɾ࠵
ͱ͋ΔΞϓϦͷ։ൃத • ը໘ભҠ͕͍͕͋Δͳʔͱࢥͬͨ
ͱ͋ΔΞϓϦͷ։ൃத • ը໘ભҠ͕͍͕͋Δͳʔͱࢥͬͨ • Nexus5Xͱ͔Ͱඵ
ͱ͋ΔΞϓϦͷ։ൃத • ը໘ભҠ͕͍͕͋Δͳʔͱࢥͬͨ • Nexus5Xͱ͔Ͱඵ • SO-04G (5.0.2)Ͱը໘ભҠʹ20sec͘Β͍ɾɾ
None
ঢ়گ • Wi-Fiଓڥ • σʔλJSONܗࣜ • αΠζ1MB • Kotlin +
Moshi(=A modern JSON library for Android and Java)
ରࡦ
ରࡦ1ɿMoshi͕ѱ͍ͷͰʁ • moshi(moshi-kotlin: SquareJSONύʔα)ϦϑϨΫγϣϯ Λ༻͍͍ͯΔͨΊɺίετ͕ߴ͍ • KotshiΛ͏ • An annotations
processor that generates Moshi adapters from immutable Kotlin data classes. • https://github.com/ansman/kotshi
ରࡦ1ɿMoshi͕ѱ͍ͷͰʁ • moshi(moshi-kotlin: SquareJSONύʔα)ϦϑϨΫγϣϯ Λ༻͍͍ͯΔͨΊɺίετ͕ߴ͍ • KotshiΛ͏ • An annotations
processor that generates Moshi adapters from immutable Kotlin data classes. • https://github.com/ansman/kotshi => 20sec -> 12sec
ରࡦ2ɿΦϒδΣΫτੜ͕ଟ͗͢Δ • ྻͷதʹΦϒδΣΫτ͕େྔʹଘࡏ͍ͯͨ͠ { “hogeArray”: [ {“obj”: {123, 456.2}},… ]
}
ରࡦ2ɿΦϒδΣΫτੜ͕ଟ͗͢Δ • ྻͷதʹΦϒδΣΫτ͕େྔʹଘࡏ͍ͯͨ͠ => ΦϒδΣΫτ͡Όͳ͘ɺStringܕͷྻͷྻͰදݱ͢Δ { “hogeArray”: [ {“obj”: {123,
456.2}},… ] } { “hogeArray”: [ [“123”, “456.2”],… ] }
ରࡦ2ɿΦϒδΣΫτੜ͕ଟ͗͢Δ • ྻͷதʹΦϒδΣΫτ͕େྔʹଘࡏ͍ͯͨ͠ => ΦϒδΣΫτ͡Όͳ͘ɺStringܕͷྻͷྻͰදݱ͢Δ { “hogeArray”: [ {“obj”: {123,
456.2}},… ] } { “hogeArray”: [ [“123”, “456.2”],… ] } => 12sec -> 8.4secʢྻσʔλ͕ͦͦڊ େͩͬͨͨΊɺ͔ͳΓ͕ࠩग़ͨʣ
ରࡦ3: APIఆٛΛݟ͢ • ྻσʔλΛ̍ͭʹڞ௨ԽͰ͖Δɾɾɾʂ • ॏෳͨ͠ྻσʔλΛ4ͭड͚औ͍ͬͯͨ => 8.4sec -> 2.9sec
·ͱΊ1 • ΄΅Kotshiͷ͓͔͕͛ͩɺ20sec -> 2.9secʹͳͬͨ • େྔͷྻσʔλʹܕΛ͚ͭΔͷΑ͘ͳ͍ • ʮͦͷɺਓྨࢥ͍ग़ͨ͠ɻؒͷύϑΥʔϚϯεࠩҟ ͷڪාΛɻͦΕͰαϙʔτ͠ͳ͚Ε͍͚ͳ͍۶ৱΛɻʯ
• SO-04G (5.0.2): 2.9sec • SO-02G (4.4.4): 0.64sec
·ͱΊ2 • iOSͰͦ͜·Ͱύʔεʹ͕͔͔࣌ؒͬͯͳ͔ͬͨͷ͕ٙ • ͔ͯ͠͠ݹ͍ͩͱ͕͔͔࣌ؒΔʁ • ը໘ભҠΞχϝʔγϣϯ(Shared Element Transition)͕͋Δͱɺ 2.9secͰ͘ײ͡ͳ͍
• ͦΕͰɺ2.9sec͔͔Δͷ͕ݏͩͬͨͷͰɺେྔͷྻͷऔಘ ผAPIʹΓग़ͨ͠ɻʢͦΕͰ1.2sec͘Β͍·ͰॖΊͯ18ഒͷύ ϑΥʔϚϯεվળୡɾɾʣ