Performance analysis of coroutines and other concurrency techniques in Kotlin language for I/O operations

Michał Grabowiec


Lublin University of Technology (Poland)

Sebastian Wiktor

sebastian.wiktor@pollub.edu.pl
Lublin University of Technology (Poland)

Jakub Smołka


Lublin University of Technology (Poland)
https://orcid.org/0000-0002-8350-2537

Abstract

This article focuses on analyzing the performance of coroutines and other concurrent processing techniques in Kotlin language for input/output operations. For this purpose, coroutines, traditional threads, thread pool and virtual threads were put together. An appropriate application was created and test scenarios were developed. A series of tests were conducted, followed by an analysis of the obtained results. These results indicate that coroutines and thread pool exhibit the highest performance, highlighting their importance in optimizing concurrent processing in the Kotlin language.


Keywords:

Kotlin, coroutines, concurrent processing

R. Elizarov, M. Belyaev, M. Akhin, I. Usmanov, Kotlin coroutines: design and implementation, Proceedings of the 2021 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward! '21) (2021) 68–84, https://doi.org/10.1145/3486607.3486751.
  Google Scholar

Octoverse: The state of open source and rise of AI in 2023, https://github.blog/2023-11-08-the-state-of-open-source-and-ai/, [23.05.2024].
  Google Scholar

D. Gotseva, Y. Tomov, P. Danov, Comparative study Java vs Kotlin, In 27th National Conference
  Google Scholar

With International Participation (2019) 86–89, https://doi.org/10.1109/TELECOM48729.2019.8994896.
  Google Scholar

D. Jemerov, S. Isakova, Kotlin in Action, Manning Publications, New York, 2016.
  Google Scholar

N. Everlönn, S. Gakis, Java and Kotlin, a performance comparison, Bachelor thesis, Kristianstad University, Kristianstad, 2020.
  Google Scholar

K. Chauhan, S. Kumar, D. Sethia, M. N. Alam, Performance Analysis of Kotlin Coroutines on Android in a Model-View-Intent Architecture pattern, In 2021 2nd International Conference for Emerging Technology (INCET) (2021) 1–6, http://dx.doi.org/10.1109/INCET51464.2021.9456197.
  Google Scholar

N. Koval, D. Alistarh, R. Elizarov, Fast And Scalable Channels In Kotlin Coroutines, Proceedings of the 28th ACM SIGPLAN Annual Symposium on Principles and Practice of Parallel Programming (2023) 107–118, https://doi.org/10.48550/arXiv.2211.04986.
  Google Scholar

A. Shafi, J. M. Hashmi, H. Subramoni, D. K. Panda, Blink: Towards Efficient RDMA-based Communication Coroutines for Parallel Python Applications, In 2020 IEEE 27th International Conference on High Performance Computing, Data, and Analytics (HiPC) (2020) 111–120, http://dx.doi.org/10.1109/HiPC50609.2020.00025.
  Google Scholar

L. Stadler, T. Wurthinger, C. Wimmer, Efficient Coroutines for the Java Platform, Proceedings of the 8th International Conference on Principles and Practice of Programming in Java (2010) 20–28, http://dx.doi.org/10.1145/1852761.1852765.
  Google Scholar

D. Beronić, L. Modrić, B. Mihaljević, A. Radovan, Comparison of Structured Concurrency Constructs in Java and Kotlin – Virtual Threads and Coroutines, In 2022 45th Jubilee International Convention on Information, Communication and Electronic Technology (MIPRO) (2022) 1466–1471, https://doi.org/10.23919/MIPRO55190.2022.9803765.
  Google Scholar

Kotlin language documentation: Dispatcher IO, https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/-i-o.html, [29.05.2024].
  Google Scholar

Kotlin language documentation: Default dispatcher, https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/-default.html, [29.05.2024].
  Google Scholar

Power of Java Virtual Threads: A Deep Dive into Scalable Concurrency, https://kiranukamath.medium.com/power-of-java-virtual-threads-a-deep-dive-into-scalable-concurrency-18fa4d382f9c,
  Google Scholar

Download


Published
2024-12-30

Cited by

Grabowiec, M., Wiktor, S., & Smołka, J. (2024). Performance analysis of coroutines and other concurrency techniques in Kotlin language for I/O operations. Journal of Computer Sciences Institute, 33, 306–312. https://doi.org/10.35784/jcsi.6353

Authors

Michał Grabowiec 

Lublin University of Technology Poland

Authors

Sebastian Wiktor 
sebastian.wiktor@pollub.edu.pl
Lublin University of Technology Poland

Authors

Jakub Smołka 

Lublin University of Technology Poland
https://orcid.org/0000-0002-8350-2537

Statistics

Abstract views: 38
PDF downloads: 25


License

Creative Commons License

This work is licensed under a Creative Commons Attribution 4.0 International License.