Drop your claimed flaws:
- When the application is launched for the first time, the application will be very slow because the bytecodes will be interpreted and the JIT compiler will do a lot of analysis to find good optimizations. Applications cannot use maximum hardware power.
Compiling JIT is an implementation issue. These are not all platforms. Indeed, the Android platform could be modified to: 1) compile in advance, or 2) cache the native code created by JIT to speed up launch the next time the application starts.
Interestingly, various Java developers tried to use these strategies at different times, and yet empirical evidence suggests that a simple JIT is the best strategy.
- Java checks to see if the index of the array is out of bounds, and checks to see if the pointers are specified. It will add some internal ifs to the generated code.
The JIT compiler can optimize many of these tests. Otherwise, the overhead is generally relatively small; for example, a difference of several percent ... not 2 times.
Please note that an alternative to checking is the risk that typical application errors will cause the Android platform to crash. Of course, garbage collection becomes problematic if applications can spoof memory.
- All objects use the garbage collector, including objects that are very easy to remove manually.
The downside is that it is easy to forget to delete objects, delete objects twice, use them after they are deleted, and so on. These errors lead to errors that are usually difficult to track.
- All instances of objects are created with dynamic memory allocation, including objects that can easily use the stack. If the iteration of the loop begins to instantiate the class and finishes deleting the created object, the allocation of dynamic memory will be inefficient.
Java dynamic memory allocation and FAST object creation. Faster than in C ++, for example.
- The garbage collector must stop the application while it clears the memory, and this is very undesirable for games, graphics applications and real-time applications.
Then use a garbage collector with a simultaneous / low pause. Another approach is to implement your application so as not to generate a lot of garbage ... and rarely run garbage collection.
- The link count is slow and it cannot handle circular links.
There is no suitable Java GC uses reference counting. (On the other hand, there are many C / C ++ manual control schemes. For example, the so-called C ++ smart pointer schemes.)
- A multi-threaded garbage collector is slower and needs to use more CPU.
In fact, you mean assembly at the same time. Yes, but that means you pay for the extra responsiveness you require for real-time interactive games / applications.
source share