Home >Common Problem >Interpretation of Ark Compiler
At the previous Huawei P30 China launch conference, Huawei said that through the Ark compiler, system operation fluency can be improved by 24%, system response can be improved by 44%, and third-party application operation fluency can be improved by 60%. It can be said to be the biggest contributor behind the Huawei P30 series experience.
As a new compilation and running mechanism for systems and applications, Ark Compiler has transformed Android from the DNA level, breaking the barriers between performance and power consumption. Seesaw solves the inefficiency problem of Android applications being explained and run at the same time, allowing mobile phones to directly understand "high-level languages". It can be said to be the biggest fundamental innovation in the Android camp in recent years.
On the afternoon of April 25, Huawei held the "Huawei Technology EMUI Media Salon" event in Beijing. At this event, Huawei for the first time explained in detail the application principles of the Ark compiler used by the P30 series in the EMUI 9.1 system from an official perspective. (Recommended learning: PHP video tutorial)
First of all, we need to understand what a compiler is. Simply put, a compiler translates the language we understand into a language composed of 0s and 1s that the computer can understand.
Just like when we communicate with foreigners, it is difficult to communicate in different languages, but as long as one of the languages is translated into a language that the other party can understand, communication can be successful.
The biggest feature of Huawei's Ark compiler is that it is the first compiler in the industry to support multi-language joint optimization, which means that both C/C and Java are supported.
Therefore, when faced with Android applications developed using mixed languages, the Ark compiler can compile into a unified process in the development environment and execute it through unified program representation and optimization, making it more efficient.
In other words, the current operating mechanism of Android is like two people preparing tasks independently, and finally integrating the results of their preparations for execution. The Ark compiler asked the two people to prepare together and then perform the task together.
The compilation of the Android system itself is run through the ART virtual machine, so it takes up a lot of system resources. The Ark compiler has already completed static compilation during development, so it does not need to rely on the phone itself for compilation.
For example, take an open-book exam. One student has previewed the knowledge points that may be tested before the exam, marked the corresponding content, and writes quickly after getting the paper; One student relies on "improvising" and temporarily flipping through materials in the examination room, which takes up a lot of examination time.
At the same time, the Ark compiler also provides a more efficient memory recycling mechanism. Since there is no need to go through a virtual machine, the application does not need to be paused during operation, and the memory can be recycled at any time, instead of piling garbage together for recycling.
Another core function of the Ark compiler is to optimize the code. The so-called code optimization is to bring higher performance to the program.
To give a very simple example, the same person takes the test twice. How can he make the second test better than the first test? In fact, it is to optimize the review.
As mentioned earlier, the existing dynamic compilation of the Android system uses the ART virtual machine to execute on the machine, while the Ark compiler performs static compilation during development.
Therefore, the former can only use simple optimization algorithms, while the latter can break through the functional limitations of mobile phones and use different compilation and optimization algorithms according to different applications.
Finally, another highlight of Huawei’s Ark compiler is its low cost of learning and use. Since the compilation environment has been integrated in the packaging stage before the APP is released, the entire process is actually simplified for developers and is more convenient to use.
Huawei stated that the Ark compiler will be fully open source starting in 2019. This means that both mobile phone manufacturers and application developers can use the Ark compiler to optimize application performance.
In general, the main advantages of compiling applications through Huawei Ark compiler compared to existing Android are:
1. Release machine compilation pressure and complete static compilation of applications during development. Not going through the ART virtual machine.
2. Adopt different types of application optimization solutions to achieve optimal application operation effects.
3. Provide a more effective memory recycling mechanism to improve system fluency.
4. Simplify the compilation process and reduce developers’ learning and usage costs.
According to Huawei’s official schedule, Ark Compiler will open source the compiled framework code at the Huawei Terminal Developer Conference in August 2019, and release the complete code at the Green Alliance Developer Conference in November 2019. Ark compiler code.
For more PHP related technical articles, please visit the PHP Graphic Tutorial column to learn!
The above is the detailed content of Interpretation of Ark Compiler. For more information, please follow other related articles on the PHP Chinese website!