Threads vs Coroutines - ParallelMap in Kotlin

Опубликовано: 02 Декабрь 2022
на канале: Pairing with Duncan
2,094
76

When running on the JVM, if we need to run things concurrently we can use Java APIs or Kotlin coroutines. In this episode we implement a parallelMap operation using streams, raw threads, a threadpool with futures, and coroutines. The results may surprise you!

This is part 55 of an exploration of where a Test Driven Development implementation of the Gilded Rose stock control system might take us in Kotlin. You can see the whole series as a playlist
   • All Gilded Rose Episodes  
and the code on GitHub
https://github.com/dmcg/gilded-rose-tdd

There has been some discussion on Reddit about my use of AtomicReference in the threads implementation. I'm persuaded that any old non-thread-safe holder would do, and would probably be more performant -   / j089h0d  

The next episode (   • Threads vs Coroutines - ParallelMap P...  ) measures the performance of the implementations.

If you like this, you’ll probably like the book Java to Kotlin, A Refactoring Guidebook
http://java-to-kotlin.dev , and maybe join Nat Pryce and me on our TDD workshop at KotlinConf in April next year https://kotlinconf.com/workshops/


Смотрите видео Threads vs Coroutines - ParallelMap in Kotlin онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Pairing with Duncan 02 Декабрь 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 2,094 раз и оно понравилось 76 людям.