atomicfu seems like good fit but what difference i...
# coroutines
v
atomicfu seems like good fit but what difference it has with Java's
Atmoic*
j
I’m not sure, I opened https://github.com/Kotlin/kotlinx.atomicfu/issues/26 to get a README section added on it
I only just found the atomicfu stuff yesterday
e
The difference is already explained in the first paragraph of its readme: “Code it like AtomicReference/Int/Long, but run it in production efficiently as AtomicXxxFieldUpdater on Kotlin/JVM”
👍 1
If that does not ring a bell, then you don’t need
atmoicfu
and you should just use java.util.concurrent.AtomicInt and its friends.
j
oh, interesting. I did not know about FieldUpdaters. I think the question is still somewhat valid. If you get to code just like java atomics, but it is more efficient, why would you ever use java atomics?
k
because there’s a big huge asterisk after “just like java atomics” if you keep reading
(do’s and don’ts section)
e
Also, like 99% of apps should not care about performance. But we develop generally-applicable libraries, so we must care about performance for that 1% and that is why we’ve created
atomicfu
to make our life easier (so that we can have nice code and good performance at the same time).
j
Yeah, makes sense. Thanks for the info. Hopefully @v0ldem0rt also got an answer from this
v
Awesome thread @elizarov thanks as usual for adding your knowledge.