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
わかった気になる、Coroutine1.7.0のチャンネルのパフォーマンス向上
Search
RyuNen344
May 13, 2023
Technology
0
330
わかった気になる、Coroutine1.7.0のチャンネルのパフォーマンス向上
RyuNen344
May 13, 2023
Tweet
Share
More Decks by RyuNen344
See All by RyuNen344
サプライチェーン攻撃に備える
ryunen344
0
1.6k
Okioに愛を込めて
ryunen344
3
1.8k
Firebase Hostingを使ってPasskeyをandroidアプリで試してみよう
ryunen344
2
1.5k
Xcode Meets Gradle
ryunen344
0
310
K/NとNSKeyedArchiverと私
ryunen344
0
450
ComposeのModalBottomSheetは (まだ)沼
ryunen344
1
1.6k
うわっ…もしかして私のコー ド、遅すぎ…?
ryunen344
1
810
K/NでCryptoKit使いたかった
ryunen344
0
370
SwiftPM with KMMをprivateなGitHub Releaseで運用する
ryunen344
0
340
Other Decks in Technology
See All in Technology
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
マルチプロダクト開発の現場でAWS Security Hubを1年以上運用して得た教訓
muziyoshiz
2
2.2k
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
26
11k
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
160
Turing × atmaCup #18 - 1st Place Solution
hakubishin3
0
470
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
110
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
120
ブラックフライデーで購入したPixel9で、Gemini Nanoを動かしてみた
marchin1989
1
520
PHP ユーザのための OpenTelemetry 入門 / phpcon2024-opentelemetry
shin1x1
1
160
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
130
Jetpack Composeで始めるServer Cache State
ogaclejapan
2
170
Featured
See All Featured
Designing for humans not robots
tammielis
250
25k
4 Signs Your Business is Dying
shpigford
181
21k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Side Projects
sachag
452
42k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Designing Experiences People Love
moore
138
23k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Transcript
Θ͔ͬͨؾʹͳΔɺCoroutine1.7.0ͷ νϟϯωϧͷύϑΥʔϚϯε্ 2023.05.13 KotlinConf 2023 Global in Kyoto Bunjiro Miyoshi
About Me • teamLab Inc.ॴଐ • (ࣗশ)ϚϧνϓϥοτϑΥʔϜܳਓ • ࠷ۙGoogle/TinkͷKMMϥούʔϥΠϒϥϦ࡞ͬͨ •
https://github.com/RyuNen344/tink-kmm
kotlinx.coroutine 1.7 ϦϦʔε͞Ε·ͨ͠Ͷ
Release Note
Release Note runTestͷdefault timeout͕60s͔Β10sʹมߋ͞ΕͨΓ
Release Note Kotlin NativeʹDispatchers.IO͕ొ
Release Note Kotlin NativeͷOld Memory Model͕আ͞Εͨ
Release Note Channelͷ࠶࣮
͢͜ͱɾ͞ͳ͍͜ͱ • ͢͜ͱ • چ࣮ɾ৽࣮ͷҧ͍ • ;ΜΘΓͱͨ͠Lock freeपΓͷ • ͞ͳ͍͜ͱ
• Lock freeपΓͷఆٛతʹਖ਼͍͠ղઆ • kumagi͞Μͷࢿྉ͕ͱͯษڧʹͳΓ·͢ • https://www.docswell.com/s/kumagi/ZP99EQ-lock-free • Ktorͷ3rd PartyϥΠϒϥϦͷӨڹ
ͳͥ࠶࣮ #1 • σʔλߏConcurrent Double Linked List • ͦͦޡͬͨཧΛݩʹ࣮ͯ͠ •
อकੑͷ • ઢܗԽՄೳੑͷ • ૢ࡞͕ஞ࣮࣍ߦ͞Ε͍ͯΔ͜ͱͷอূ
ͳͥ࠶࣮(Double Linked List) #1 ઌ಄ͱ࠷ޙͷϙΠϯλΛอ࣋ w w w w
ͳͥ࠶࣮(Double Linked List) #1 ཁૉྡ͢ΔͷϙΠϯλΛอ࣋
ͳͥ࠶࣮(Double Linked List) #1
ͳͥ࠶࣮(Double Linked List) #1 ৽͍͠ཁૉͷੜ DoubleLinkedListࣗମͷઌ಄ͱ چઌ಄ͷཁૉͷྡ͢ΔཁૉΛߋ৽
ͳͥ࠶࣮ #2 • ࣮͕ෳࡶʹͳ͍ͬͯͯbyte code size, dex sizeʹѱӨڹ • DCAS,
N-word CASͰ࣮ • ֦ுੑɺਖ਼֬ੑɺύϑΥʔϚϯεʹ͕͋Δ • CASɿCompare And Swap જࡏతͳσʔλڝ߹ͷ͕ൃੜͨ͠߹ͷਪଌͱमਖ਼Λࠔʹ͍ͯͨ͠
ͳͥ࠶࣮(Compare And Swap) #2
ͳͥ࠶࣮(Compare And Swap) #2 Pointerͷٙࣅίʔυ
ͳͥ࠶࣮(Compare And Swap) #2 PointerͷͱPointerʹೖͬͯΔ͖ΛνΣοΫ w w
ͳͥ࠶࣮(Compare And Swap) #2 ظͲ͓Γͷ͕Pointerʹ֨ೲ͞Ε͍ͯͨΒߋ৽
ͳͥ࠶࣮(D-Compare And Swap) #2
ͳͥ࠶࣮(D-Compare And Swap) #2 ظͲ͓Γͷ͕Pointerʹ֨ೲ͞ΕΔ·ͰԿCAS
ͲͷΑ͏ʹ࠶࣮ • σʔλߏྻͰ࣮ • ΦϒδΣΫτૢ࡞Fetch And Addʹมߋ
ͲͷΑ͏ʹ࠶࣮(Fetch And Add) Pointerʹೖ͍ͬͯͨݹ͍ΛҰ࣌อଘͯ͠ॲཧΛ࣮ߦ
ͲͷΑ͏ʹ࠶࣮(Fetch And Add) Ұ࣌อଘͨ͠ݹ͍Λݺͼग़͠ݩʹฦ٫
࠶࣮ͯ͠Ͳ͏ͳΔ • ҰൠతͳڥͰ10 ʙ 25%ߴԽ
·ͱΊ • 1.7.0ͰChannelࣗମͷ࠶࣮͕ͳ͞ΕͯύϑΥʔϚϯε্͕ͨ͠ • (Opt)BroadcastChannelܥΛআ͢Δ४උ͕ͬͨ • (Opt)͜ͷ࠶࣮ͷ͓͔͛ͰsemaphoremutexपΓͷվળೖͬͯ ͍Δ
͍͞͝ʹ ࢿྉ࡞ͬͯͨΒ1.7.1ϦϦʔε͞Εͨ😂
Ҿ༻ • https://github.com/Kotlin/kotlinx.coroutines/releases/tag/1.7.0 • https://github.com/Kotlin/kotlinx.coroutines/issues/3621 • https://github.com/Kotlin/kotlinx.coroutines/pull/3103 • https://arxiv.org/abs/2211.04986