“ARK Compiler” is a big bet for Huawei’s App management system, the company introduced it with the launch of P30 series and in a recent media briefing, the Huawei gave in-depth information of this new technology and its future in Huawei device ecosystem.
Ark compiler can improve Android system operation fluency by 24%, response speed by 44%, and the smoothness of the third-party application up to 60%.
Now it’s time to dive deep into this subject:
During the EMUI software communication meeting in China, Dr. Wang Chenglu, President of Huawei Consumer BG Software Division, said this new technology is a breakthrough for Huawei and designed to work alongside EMUI. The official explained the details about this new revolutionary technology from the following.
To learn more about ARK compiler we’ve to understand what really the compilation process is:
Most of the Android platform applications are written in Java, but at the bottom what really makes the computer understand and execute the code is the machine language, which is a binary code consisting of “0” and “1”. Therefore, to run the program the high-level language (Java) must be transformed into machine language (Binary Code).
Generally, there are two ways to compile the language:
1. Introduce an interpreter to translate: which works by understanding a Java statement and translating it into machine code, letting the hardware execute it freely and called – Interpreting execution or Interpreter. This process does not filter the code, and the execution efficiency is very low + takes time.
2. The direct translation of high-level languages into machine language: There are two methods into this process:
A. AOT (Ahead of time) Compilation: Compiles the languages before running the program.
B. JIT (Just in time) Compilation: Compiles the languages in the run time or in real time.
Prior to Android 5.0, Android used high-level language code to interpreting execution + JIT but the provided very low efficiency while running a program. In the process of development, with the launch of Android 6.0, Android introduced Android Runtime (ART) virtual environment.
Currently, Android uses a comprehensive model compilation process with the combination of interpreting execution + JIT + AOT.
So, What is a Compiler?
A compiler is a tool or software that translate source code from a high-level programming language to a machine executable language and creates a single executable program out of all of the language files/resources.
How “ARK Compiler” is different from a regular compiler
APK Compiled with ARK Compiler directly translates high-level languages in the form of Machine Language, that runs into the phone without even the need of a virtual machine or the need a bridge to translate it for the phone. This saves a huge amount of resources during interpretation or switching between high to low-level languages and provides a high-performance boost to the application.
We can understand this whole process in two simple steps:
First of all, the compilation process of the ARK compiler supported program is completed on the developer side, in the process of program development, the developer directly compiles different programming languages into machine code, and creates an executable APK (Android Application).
When the app installed in the Operating system, it can directly identify and perform required actions without taking extra time and storage to interact and interpret language conversation with the virtual machine, providing a boost to the overall speed of the application.
Secondly, Ark compiler uses the memory recycling process that is used to recycle unused memory and restores it back to the system without even suspending the current background application, this helps a lot in app resuming and improves memory management. This could be taken as a way to bypass Android’s traditional virtual machine.
All of this process improves system operation fluency by 24% and the system response speed by 44%, as well as third-party application performance by up to 60%.
What are the difficulties for Huawei?
Dr. Wang Cheglu explains Compiler development requires a long-term research and development process, at the same times the developers of the compiler needs to be expert in high-level languages, familiar with various language frameworks as well as machine language.
Google has acquired such professionals for a long time and on a very large scale, that’s why there are many frameworks and applications developed by the firm. If you want to recreate a compiler from scratch that can adopt Google’s software ecosystem, the workload of that compiler has been to very huge, the Wang said.
How ARK compiler came alive?
According to Dr. Wang, Huawei’s interest in compiler development started in 2009, when its research and development program was originally initiated. It has inspired the first batch of the researcher in China and abroad to join and create a compilation group.
In 2013, Huawei self-developed and launched its first compiler for base stations, which is the official proposal of the Huawei compiler framework and the predecessor of ARK compiler.
In 2014, chief scientist of Huawei compiler technology established the main architecture of ARK compiler. In 2015, Huawei launched its own programming language. In 2016, the compiler and programming language lab was established. In 2019, Huawei officially launched the Ark compiler.
This whole development process took ten years and hundreds of researchers as well as hundreds of millions of dollars investment.
Dr. Wang said that the Android system optimized with Ark compiler is close to Apple’ IOS terminology. The next step of Huawei is to promote this new compiler into the Android ecosystem and to constantly update it to allow users to use more pure Android programmes.
Dr. Wang also announced that The Huawei Ark Compiler will be fully open sourced around November 2019, and invited the entire industry to work together to improve and enhance the Android performance experience.