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.4k
Okioに愛を込めて
ryunen344
3
1.7k
Firebase Hostingを使ってPasskeyをandroidアプリで試してみよう
ryunen344
2
1.4k
Xcode Meets Gradle
ryunen344
0
300
K/NとNSKeyedArchiverと私
ryunen344
0
440
ComposeのModalBottomSheetは (まだ)沼
ryunen344
1
1.5k
うわっ…もしかして私のコー ド、遅すぎ…?
ryunen344
1
800
K/NでCryptoKit使いたかった
ryunen344
0
360
SwiftPM with KMMをprivateなGitHub Releaseで運用する
ryunen344
0
320
Other Decks in Technology
See All in Technology
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
210
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
170
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
110
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
470
TypeScript、上達の瞬間
sadnessojisan
46
13k
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
3
200
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
220
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
470
スクラムチームを立ち上げる〜チーム開発で得られたもの・得られなかったもの〜
ohnoeight
2
350
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.6k
iOSチームとAndroidチームでブランチ運用が違ったので整理してます
sansantech
PRO
0
130
Featured
See All Featured
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Thoughts on Productivity
jonyablonski
67
4.3k
Building Applications with DynamoDB
mza
90
6.1k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Designing the Hi-DPI Web
ddemaree
280
34k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
The Pragmatic Product Professional
lauravandoore
31
6.3k
What's new in Ruby 2.0
geeforr
343
31k
Docker and Python
trallard
40
3.1k
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