Ark Compiler is a system and application compilation and running mechanism launched by Huawei to improve the compilation efficiency of the Android system.
In April 2019, Huawei announced this technology for the first time at the Huawei P30 series domestic launch conference. (Recommended learning: PHP video tutorial)
Compiler is to translate "a computer language (usually a high-level language)" into "another computer language (usually a low-level language) )"program of. High-level computer languages are convenient for developers to write, read, communicate, and maintain, such as Pascal, C, C, Java, etc., while low-level machine languages are machine codes (Machine codes) that computers can directly interpret and run.
Huawei's Ark compiler converts JAVA and C/C used by Android application developers into machine code. According to Wang Chenglu, Huawei began to consider making compilers in 2009, “Because after HiSilicon made the chip, we needed our own compiler to truly unleash the capabilities of the chip. Starting in 2013, Huawei’s own self-developed compiler The compiler is called HCC."
According to the timetable, in 2012, Huawei established a compiler and programming language laboratory. In 2014, technology expert Fred Chow joined Huawei to be responsible for the main architecture of the compiler. , after ten years of exploration, Huawei finally launched the Ark compiler.
According to official data released by Huawei, compared with previous Android application development, Ark Compiler can improve system operation fluency by 24%, improve system responsiveness by 44%, and can also improve 60% smooth operation of third-party applications (Weibo Express Edition).
Eliminates cross-language calling overhead
Wang Chenglu explained to reporters in detail the working principle of the Ark compiler to improve fluency and responsiveness.
First of all, the Ark compiler is a multi-language joint optimization compiler, which "eliminates cross-language call overhead, which is one of the core reasons that affect Android performance overhead."
According to Wang Chenglu Introduction, currently 95% of APPs in the Android application market are developed in multiple languages: "The logic part is all Java code, but in order to enhance its capabilities, probably all APP developers will write a library in C for Java To call."
Java is an object-oriented programming language with the characteristics of simplicity, object-oriented, and distribution. Although its operating efficiency is not as good as C, it has the advantages of high development efficiency and stronger cross-platform. JAVA has become the first choice for Android development, and calling local C/C libraries through JNI is what developers are currently doing.
However, the use of interface calls between Java and C language will inevitably cause additional performance overhead; Wang Chenglu said that Huawei's Ark compiler compiles different language codes into a set of executable files in the development environment, and executes them like this higher efficiency.
Eliminates the virtual machine mechanism that affects performance and reclaims memory in real time
Wang Chenglu believes that the second major feature of Huawei's Ark compiler is the elimination of the virtual machine mechanism that affects performance .
In the development process of the Android system, virtual machines cannot be ignored: the Android system is built with Linux as the kernel. In order to reduce the difficulty of application development and adapt it to devices with different hardware configurations, Google A virtual machine is built on top of the Linux kernel. Android applications are developed using Java and run on the virtual machine.
Can flexibly realize performance optimization of different applications
Wang Chenglu said that the third highlight of the Ark compiler is that it can flexibly realize performance optimization of different applications.
He said that most of the existing Android compiled code runs in a virtual machine environment, and the creation of virtual machines comes from the same set of "templates", making it difficult to perform in-depth optimization: different applications have different optimization requirements. ; In contrast, the Ark compiler is different. Each application compiles and optimizes its own plan to form optimized machine codes for different applications. "It is equivalent to saying that we provide every pursuing application developer with It gives you an opportunity to make your own applications better, and is no longer limited by the limitations of the Android virtual machine."
For more PHP-related technical articles, please visit PHP Graphic Tutorial Column for learning!
The above is the detailed content of What is the Ark compiler?. For more information, please follow other related articles on the PHP Chinese website!