What's new

Closed Ark Compiler Explained: How Huawei's App Compiler May Improve Android App Performance

Status
Not open for further replies.

Miz_Me

Contributor
Joined
Apr 6, 2017
Posts
11,206
Reaction
4,452
Points
2,660
Age
26
Much of the recent conversation around Huawei has revolved around the company’s unfortunate political situation because of a You do not have permission to view the full content of this post. Log in or register now.. The repercussions of such a pivotal decision are far too enormous to not pay attention. But in an alternate reality where this executive order does not exist, Huawei would have been in the limelight for its recently revealed Ark Compiler, the latest innovation that claims to bridge the app performance gap between Android and iOS.

Ark Compiler by Huawei

Huawei has been working towards developing a more efficient solution and has consequently hired hundreds of experts in the field. The result of this effort is the Ark Compiler, which Huawei claims is the first-ever static compiler that allows for direct translation into machine language, completely removing the need for an interpreter. Ark Compiler was also developed with the goal of maximizing running efficiency for Java and C, so one should theoretically see the best results with these languages.
635023

Huawei presents some key features of the Ark Compiler as below:


  • Compilation techniques such as AOT and JIT can convert some programs into machine code and run them directly on the CPU, but these techniques are unable to completely untether themselves from the interpreter and limitations attached therewith. The Ark Compiler utilizes static compilation, which lets it untether itself from the dynamic interpreter, opening the possibility of boosting app performance by “leaps and bounds.
  • Static compilation has a potential downside of being too rigid and being unable to make adjustments that a dynamic compiler can make during execution. Huawei claims that the Ark Compiler’s static compilation resolves this “by seamlessly translating the dynamic features in the programming language into machine code.
  • Existing compilation processes take place during or after installation of the app package on the mobile device. Ark Compiler is designed for deployment during software development, which we presume helps to remove time overheads during installation and execution. We presume that app developers would be able to directly compile different languages into native machine code during the app development process, and the resultant APK could thus not need interaction with an interpreter or a virtual machine to function. This would theoretically reduce the overheads related to JNI, for instance.
  • Ark Compiler also changes the collective nature of Garbage Collection. It allows for GC events to occur separately for different Java threads. This compartmentalized approach claims to offer less jank on foreground apps.

AndroidGC-1024x416.jpg ArkGC-1024x435.jpg
As a result of these changes, Ark Compiler can seemingly improve Android system operation fluency by up to 24%, response speed by up to 44%, and the smoothness of the third-party applications by up to 60%, claiming to bring Android app performance at the same level as that on iOS.


The Ark Compiler is currently compiled and optimized for ARM chip architecture. Huawei hopes that in the future, collaborative hardware and software design will work towards maximizing Kirin chip capabilities.


The Ark Compiler supports standard Java usage, allowing for the direct compilation of third-party apps without needing the app developer to make any code modification. Ark Compiler also allows for “adjustments to the code structure” for further improvements to performance and memory. Huawei has chosen to make Ark Compiler an open source system, which would allow third-party developers to adopt and adapt the technology for their needs, furthering its adoption with app developers and mobile phone manufacturers.


While Huawei does not mention any cons to the Ark Compiler, one can expect large app sizes at the very least, but this should not pose any problems on current generation devices which come with ample storage. We also expect that Ark Compiler will not be available for all CPU architectures, as Google’s compatibility woes are not Huawei’s headache. Ark Compiler is designed to be used during development and not during installation; this presents an indication that Huawei may have possibly modified how apps are deployed and installed on Android devices, and also may have worked on their own APK design. If correct, this could pose a major compatibility problem in the ecosystem, and it would be a long while before this would become a standard Android feature, if ever.


Not compiling on a user’s device also raises a big question on optimization. ART currently optimizes on a per-micro-architecture basis, meaning that the resulting binary would be different for a Snapdragon device versus an Exynos device, or even for a You do not have permission to view the full content of this post. Log in or register now. versus a Snapdragon 625. This approach makes sense for manufacturers who have full control of the SoC, like Apple and Huawei. However, with the rest of the Android world using many different SoCs, forcing a generic optimization to be used across devices will be a roadblock for the standardization of the Ark Compiler, again. Consequently, do not expect Ark Compiler to arrive on your favorite custom ROM anytime soon.


For clarification, the Ark Compiler is developed to work with Android, and Huawei has mentioned nothing in relation to its You do not have permission to view the full content of this post. Log in or register now. and its compatibility with Ark Compiler, so we make no presumptions on this end.


Huawei plans to hold two major conferences dedicated to developers and the larger ecosystem. These are the Huawei Device China Developers Conference and the Green Alliance China Developers Conference. Both events will address specific open source issues related to Huawei’s Ark Compiler, in an effort to make the benefits of this technology as widely accessible as possible.

Source: XDA
 

Attachments

Status
Not open for further replies.

Similar threads

Back
Top