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
940
APIのデータのマッピングを 約18倍速くした話
magiepooh
February 22, 2018
Tweet
Share
More Decks by magiepooh
See All by magiepooh
今さら角丸のTransition
magiepooh
0
1.2k
Google I/O Extended Tokyo 2018
magiepooh
2
1.5k
まだAPI定義管理で消耗してるの?〜Swaggerを用いた大規模アプリ時代のAPI定義管理とコードジェネレート〜
magiepooh
38
18k
RootBeer
magiepooh
0
790
Customize Error Message
magiepooh
0
780
Kotlin入門
magiepooh
2
1.7k
Adjust Full Screen
magiepooh
2
480
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
PHPからGoへのマイグレーション for DMMアフィリエイト
yabakokobayashi
1
170
Snowflake女子会#3 Snowpipeの良さを5分で語るよ
lana2548
0
230
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
560
UI State設計とテスト方針
rmakiyama
2
600
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
AI時代のデータセンターネットワーク
lycorptech_jp
PRO
1
290
Google Cloud で始める Cloud Run 〜AWSとの比較と実例デモで解説〜
risatube
PRO
0
110
Qiita埋め込み用スライド
naoki_0531
0
5.1k
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
14
12k
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
160
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
330
Snykで始めるセキュリティ担当者とSREと開発者が楽になる脆弱性対応 / Getting started with Snyk Vulnerability Response
yamaguchitk333
2
190
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Thoughts on Productivity
jonyablonski
67
4.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
A Tale of Four Properties
chriscoyier
157
23k
Making Projects Easy
brettharned
116
5.9k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Building an army of robots
kneath
302
44k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.3k
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ഒͷύ ϑΥʔϚϯεվળୡɾɾʣ