https://kotlinlang.org logo
#feed
Title
# feed
a

Anupam

06/25/2019, 7:19 AM
If you are a BE developer using Java or an Android dev who want to write BE and if you know kotlin, that's a breeze. Here is Matt thorfiled helping us understand the same. Matt is the author of Spring Boot Application using Kotlin course on LinkedIn Learning. https://medium.com/androidiots/androidiots-podcast-15-using-kotlin-as-a-backend-language-with-matt-3f8f0aa78b00
👍 1
p

Pavlo Liapota

06/25/2019, 8:02 AM
Nice podcast, but why would you say that Kotlin is slower than Java by fractions of a second because of null checks without any benchmarking? Why?
d

dr.dreigh

06/27/2019, 8:25 AM
I think it was a fair explanation of the minor overhead Kotlin brings and the null checks were a good example of this, and one which is simple to explain on a podcast format.
There are benchmarks that demonstrate this also (https://sites.google.com/a/athaydes.com/renato-athaydes/posts/kotlinshiddencosts-benchmarks). So I don't think Matt spoke incorrectly here. The Kotlin-Benchmarks JMH project on jetbrains' github also highlights several areas where the performance of Kotlin is slower than the java equivalents. Still totally worth it imho 🙂
p

Pavlo Liapota

06/27/2019, 8:56 AM
These benchmarks are good, they show that some constructs are slower than the other. While Matt basically said that any Kotlin code is slower than Java as you will find null checks in bytecode for almost any Kotlin code. Long time ago I saw benchmark showing that Kotlin with these null checks is even tiny bit faster (within error range) than Java. JWM JIT is pretty good in optimizations. But even if we assume that null checks makes Kotlin slower, what does fractions of a second mean? Is it 0.1s or 0.0000001s per each check? The last one looks more like a truth so does it even make sense to mention it?
All I want to say, that it feels for me wrong to say that performance is a disadvantage of Kotlin. I think average Kotlin code would be even faster than Java as usually in Kotlin you can write clean code without performance sacrifice.
d

dr.dreigh

06/27/2019, 9:12 AM
Yeah I see what you mean - it's a hard question to answer (especially on a podcast interview!) because there is a difference but it's not something the majority of application developers need to concern ourselves with (and if you did you probably wouldn't be using Java, but a systems language instead e.g. C, Rust)
6 Views