Threads vs Coroutines - ParallelMap Performance

This page summarizes the projects mentioned and recommended in the original post on /r/Kotlin

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern API for authentication & user identity.
  • LearnThisRepo.com - Learn 300+ open source libraries for free using AI.
  • jmh

    https://openjdk.org/projects/code-tools/jmh

    In the last episode we implemented a parallelMap operation using streams, raw threads, a threadpool with futures, and coroutines. At first glance the raw threads was quickest, followed by futures, coroutines and then streams. In this, part 56 of an exploration of where a Test Driven Development implementation of the Gilded Rose stock control system might take us in Kotlin, we investigate the performance of the different functions further, in particular digging down into why coroutines seem to be slow and finding a way to speed them up. We also find a way to use a particular ForkJoinPool to run the streams code, making it as fast as the others (bar the raw threads). Frankly we only use very rough benchmarks here, with no statistical testing except 'it looks like'. That's OK for gross differences, but is highly suspect when deciding which of two similarly performant approaches is faster. For that check out JMH and you could watch my video from KotlinConf 2017

  • gilded-rose-tdd

    A TDD implementation of the Gilded Rose stock control system

    You can see the code on GitHub

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts