Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Actually there are cases in which Java is better but kotlin is still better if you see the whole picture :D
-
@ilikeglue compared to age of both languages I'm sure Java is better in some cases (if not a lot of cases)
But the code is waaaay less and more readable than Java. But both use JVM so I guess not much of a difference in performance? -
Sorry to break it to you, kotlin runs a lot slower because the jvm assembly code is not ran thru the java optimization steps
-
@sharktits in that case then why did Google support it in Android Studio? Android already has that bad reputation of running slower than iOS, now kotlin apps run slower :\
-
Good fucking question, i wanted to like kotlin too, but after some significant slow down on one of my projects, i just scrapped it. As it stands now, its mostly suited for smaller apps, what makes it really redundant, because react native does that job a lot better.
-
@sharktits HELL NO React Native DOES NOT!
Sorry caps all lol
React is cool for tiny projects only, but I've made two projects which are of the same size of the app i'm doing for my own, they are waaay slower than my kotlin app tbh
We cannot blame RN I might have made coding mistakes, but at least login page of both apps have different speeds in rendering (RN is rendered on a Galaxy S8+, while kotlin is rendered on an Alcatel Flash) and kotlin renders faster, (after disabling all init code, just rendering UI no inits happening in code behind while rendering) -
@sharktits source? because I was under the impression that Kotlin was actually faster than Java
-
@mjones44 @vlatkozelka @vlatkozelka I have not found issues but was wondering since they end up in same JVM Kotlin and Java should have same performance? Or does Kotlin have its own optimization?
-
@gitpush I could be wrong but AFAIK Kotlin does some neat stuff under the hood because of the null-safety features that allow it to generate more efficient bytecode
-
@mjones44 at least the result code that we devs see is readable and less of a pain compared to Java especially those get and set functions, I really hated them, take more lines for simple task
-
cyanly6287yAlways convert to Kotlin when reading someone else’s code. The difference is night and day.
-
sSam15017y@gitpush @vlatkozelka @mjones44 I would guess their performance to be pretty similar. Wouldn't be surprised if Java was a bit more efficient because of years of optimizations, however Kotlin devs could have just taken best compile methods from java compiler source code to match the performance closely.
I haven't used Kotlin myself, but depending on their implementation of data/value classes it might perform faster. That is, if they don't create object for data classes. -
@sharktits Kotlin is actually as fast (and faster) than Java, though has a little more overhead some places (e.g. null checks everywhere, but much rather that than typing them myself)
-
@ilikeglue Name me one example, as I struggle to find one where Java may possibly reign against Kotlin
-
sSam15017yWould be great if people stopped saying things without any proof. Anyways, here's some benchmarks:
https://sites.google.com/a/... -
sSam15017y@vlatkozelka Pretty sure she's talking about null checks in byte code, not in Kotlin source code. Also I've never seen code that required that many null checks, something might be wrong with your code base. I guess in worst case you could just:
try {
doShit(x.y.z.k);
catch (NullPointerException e) {}
Might have side effects, depends how doShit() works, but don't think this is such a realistic example. -
sSam15017y@vlatkozelka I definitely agree that Kotlin statement is way better, just wanted to mention that I've never worked on code that would require such null checks. My main point was a guess what @Proximyst meant by null check overhead.
-
@gitpush performance is not just vm dependant in this case. It also depends on the compiler which creates the byte code. But yeah moetly same speed.
-
@vlatkozelka @Ssam I am a full on Kotlin fan, to the extent where I hardly remember Java syntax; It is simply a language which has everything in Java and more. Amazing, really.
-
@vlatkozelka That was wonderful to me. I however hated forced null safety, but grew accustomed to it and love it due to Rust and Crystal
Related Rants
The joy of using Kotlin instead of Java :')
Though if I'm not mistaken they produce almost same out put :\ but writing kotlin is just time saving IMO
rant
though same result?
kotlin
java