K
K
karpo5182019-06-15 16:54:35
Java
karpo518, 2019-06-15 16:54:35

Why is Android still so dependent on jvm?

I am far from mobile development and am interested more as an Android user. I do not believe that the jvm environment will ever learn to use system resources more optimally than the native platform. I perfectly understand why developers are in no hurry to abandon the well-known development environment with a huge number of auxiliary tools and libraries. I don't understand why Google doesn't motivate them to turn away from jvm. I would like to know the opinion of those who are brewing in this. Is Kotlin an attempt to get away from the jvm at least in the future? What stack is used in gamedev? Isn't c# + xamarin a good alternative? Thanks for answers!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2019-06-15
@sergey-gornostaev

First, Kotlin runs on the JVM. Secondly, C# programs will run on the CLR virtual machine, which is also not a native platform. Thirdly, it is enough to know the purpose of virtual machines to get an answer to your question. Cross-platform in mobile development is even more important than in any other.
And finally, you are wrong about this.
Java code can be faster than native code. Back in 2009, James Gosling said:

These days we're beating the really good C and C++ compilers pretty much always. When you go to the dynamic compiler, you get two advantages when the compiler's running right at the last moment. One is you know exactly what chipset you're running on. So many times when people are compiling a piece of C code, they have to compile it to run on kind of the generic x86 architecture. Almost none of the binaries you get are particularly well tuned for any of them. You download the latest copy of Mozilla,and it'll run on pretty much any Intel architecture CPU. There's pretty much one Linux binary. It's pretty generic, and it's compiled with GCC, which is not a very good C compiler.
When HotSpot runs, it knows exactly what chipset you're running on. It knows exactly how the cache works. It knows exactly how the memory hierarchy works. It knows exactly how all the pipeline interlocks work in the CPU. It knows what instruction set extensions this chip has got. It optimizes for precisely what machine you're on. Then the other half of it is that it actually sees the application as it's running. It's able to have statistics that know which things are important. It's able to inline things that a C compiler could never do. The kind of stuff that gets inlined in the Java world is pretty amazing. Then you tack onto that the way the storage management works with the modern garbage collectors. With a modern garbage collector, storage allocation is extremely fast.

V
Vyacheslav Zolotov, 2019-06-15
@SZolotov

c# + Xamarin.Android is about something else. This is an opportunity to develop applications for Android in C #, which will be native in terms of UI rendering. It's not about abandoning jvm, although of course Xamarin.Android has AOT + LLVM build options)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question