https://kotlinlang.org logo
#feed
Title
# feed
c

Charlie Tapping

10/30/2023, 3:07 PM
Hey! I’ve been working on a multiplatform lib that turns normal data structures into concurrent versions of themselves. Theres a detailed blogpost here going over the algo and some interesting cpu intrinsics https://dev.to/charlietap/making-my-concurrent-algorithm-6000-better-24oo
👀 6
K 5
m

Michael Paus

10/30/2023, 4:10 PM
How does this compare to just using https://github.com/Kotlin/kotlinx.collections.immutable directly?
c

Charlie Tapping

10/30/2023, 4:15 PM
Performance would be night and day, immutable collections clone memory so you likely looking at a lot brk syscalls
Could be interesting thing to add to the benchmark suite though as I’m curious myself
2
I spent some more time thinking about this, immutable map is not a replacement for concurrent map. It doesn’t let multiple threads manipulate the same shared state. When you mutate it you get back a new map. It two threads update the same reference to a map concurrently, then one of the changes will not exist, which ever thread updates the reference first would have their change lost. For this reason it doesn’t make sense to include it in the benchmark as its not apples to apples and can’t actually do what we need
👍 1
2 Views