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
780
Customize Error Message
magiepooh
0
780
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
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
DynamoDB でスロットリングが発生したとき/when_throttling_occurs_in_dynamodb_short
emiki
0
250
DynamoDB でスロットリングが発生したとき_大盛りver/when_throttling_occurs_in_dynamodb_long
emiki
1
430
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
760
SRE×AIOpsを始めよう!GuardDutyによるお手軽脅威検出
amixedcolor
0
170
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
230
Engineer Career Talk
lycorp_recruit_jp
0
190
Amplify Gen2 Deep Dive / バックエンドの型をいかにしてフロントエンドへ伝えるか #TSKaigi #TSKaigiKansai #AWSAmplifyJP
tacck
PRO
0
390
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
190
20241120_JAWS_東京_ランチタイムLT#17_AWS認定全冠の先へ
tsumita
2
300
アジャイルでの品質の進化 Agile in Motion vol.1/20241118 Hiroyuki Sato
shift_evolve
0
170
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.2k
Featured
See All Featured
For a Future-Friendly Web
brad_frost
175
9.4k
Bash Introduction
62gerente
608
210k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
GraphQLとの向き合い方2022年版
quramy
43
13k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Automating Front-end Workflow
addyosmani
1366
200k
Gamification - CAS2011
davidbonilla
80
5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Optimizing for Happiness
mojombo
376
70k
Done Done
chrislema
181
16k
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ഒͷύ ϑΥʔϚϯεվળୡɾɾʣ