Skip to content

Latest commit

 

History

History
213 lines (154 loc) · 14.6 KB

Readme.md

File metadata and controls

213 lines (154 loc) · 14.6 KB

good-story


Generic badge GitHub License

GS - Report Run

GS - Coroutines Intro - CPP

GS - Coroutines Intro - JVM

GS - Java GS - Kotlin GS - Kotlin - Loom

Codacy Badge Known Vulnerabilities

Codacy Badge codecov Coverage Status

GitHub language count GitHub top language GitHub top language


Technologies used

Please check the TechStack.md file for details.

1. Introduction

An investigation and comparison between Kotlin and Java on an engineering level. Since beauty is in the eye of the beholder, this repository is not meant to evaluate Java or Kotlin on an aesthetic level.

This project started as an idea to explore differences in performance between different projects. It has grown now into a full fledge comparison between Java and Kotlin and ONLY for engineering purposes.

I won't dive into style IT discussions in this project. And of course the elegant card is not the focal point here.

If you understand these terms, then I think you'll find this project interesting.

The way we are going to compare performance, response times and memory usage is going to be by processing a small novel I'm developing in the GoodStory file. We will apply algorithms to it, make objects, and explore the limits of our own machines.

Further, you may find that I'm using for, while and a do..while in both Java and Kotlin implementations. This is purposely done in some cases. I may find that in some cases there is no point in using the already implemented algorithm for some situations. Especially if they can be implemented in exactly the same way in Java or Kotlin without the use of a DSL.

Lombok usage will be avoided as much as possible and so please do not be surprised if you get to see any manual implementation of the builder pattern.

1.1. About performance

It caught my attention recently that in many blogs and videos, people are stressing out that coroutines and virtual threads are not about performance. That is of course directly true. What they are about is making a better use of a resource that has been there for ages. Sometimes called Continuation, sometimes called coroutines, but this is a concept that has been here for a long time. This repository is, regardless, about performance, because if we use our resources better, then that will ultimately result in better performance as a whole. So this repo is not about comparing the individual performance of one coroutine to one virtual thread. They work as a whole, both switch context, both can be suspended and both have different states. So I am measuring, or better yet, attempting to measure performance on a local machine and try to see if there is any significant difference there. These tests are also allowing to exhaust resources and therefore forcing each implementation to manage itself. It's here where the performance study comes in.

This repo is the official support repo to my article on medium:

Stable releases


2. Environment

Java Project Loom is itself a JDK and in order to use it, you need first to install it

Be sure to run . ./sdk19.sh before running any of the commands, but only if you don't have JDK19 installed. This script installs JDK19 using SDK-MAN.


3. Tech comparisons

We cannot 100% compare Kotlin and Java in a direct way, but we will compare them using their best performant version.

JDK 19 is now available to install in different ways and it has been released. This means that this project is being updated as standard.

Please keep checking the evolution of file Log.md if you want to keep up to date with the results of the comparisons. It gets updated per commit. You can also check the detailed file for Java and the detailed file for Kotlin.


4. How top run

You can run the whole test in one go by running:

make clean build-run

For heavier tests please run:

make clean build-run-loccal

5. Coffee Sessions ☕️


6. Resources

Online

Videos

Books

  • Mcdowell, G. (23rd April 2020). Cracking the Coding Interview 189 Programming Questions and Solutions. (6th Edition). CareerCup
  • Cormen, T. Leiserson, C. Rivest, R. Stein, C. (2009). Introduction to Algorithms. (Third Edition). MIT Press

About me

GitHub followers