Mobile Development 18 min read

Kuikly’s Secrets to Native‑Level Performance on HarmonyOS

This article details how Tencent's Kuikly cross‑platform framework was adapted for HarmonyOS, covering its architecture, rendering layer adaptations, performance benchmarks, Kotlin Native integration, debugging tooling improvements, Compose DSL support, and future technical outlooks.

Tencent TDS Service
Tencent TDS Service
Tencent TDS Service
Kuikly’s Secrets to Native‑Level Performance on HarmonyOS

Background

Kuikly is a widely used cross‑platform development framework at Tencent, built on Kotlin Multiplatform to provide a unified stack for Android, iOS, HarmonyOS, Web, and mini‑programs. The framework adds HarmonyOS support and Compose DSL, improving multi‑device adaptation and development efficiency.

HarmonyOS Adaptation Overview

Kuikly focuses on high performance and dynamic rendering. Early adaptation to HarmonyOS Next achieved native‑level performance after iterative optimization.

Measured results (Huawei Mate60):

Page open speed on HarmonyOS is six times faster than RN.

Performance matches Android version, comparable to native.

Overall Adaptation Strategy

1. Kuikly Architecture Review and Advantages

Kuikly provides a one‑code‑multiple‑platform solution with extreme performance, dynamic capabilities, and native experience. It consists of two parts:

KuiklyUI: supports a self‑developed DSL and Compose DSL for UI development, using lightweight native rendering and page‑level dynamic updates.

KuiklyBase: offers cross‑platform components, debugging, build, release, monitoring toolchains, and stability monitoring.

Key advantages:

One codebase for five platforms (Android, iOS, HarmonyOS, Web, mini‑programs).

Native‑level performance via Kotlin compilation to platform‑specific binaries.

Kotlin‑driven toolchain enables unified IDE usage and performance analysis.

Declarative + reactive DSL improves UI development efficiency; Compose DSL is open‑sourced as a beta.

Page‑level dynamic rendering with near‑zero performance loss.

Lightweight, stable, and easy to maintain.

2. Overall Adaptation Plan

The adaptation involves integrating with HarmonyOS UI system, wrapping atomic components, handling events, and optimizing performance and stability. Kotlin cross‑platform logic is compiled to efficient native binaries for HarmonyOS, with interoperability layers and debugging plugins added.

Rendering Layer Adaptation

1. ArkUI Rendering Instruction Mapping

Original challenge: Android/iOS use imperative UI APIs, while HarmonyOS uses declarative ArkUI. The solution began with a unified Builder entry and full‑property binding, then moved to a command‑style CAPI for better performance.

Issues with the declarative approach included doubled component hierarchy, full‑property updates, and limited reuse, leading to the final CAPI solution.

2. C Node and ArkTS Component Nesting

To support mixed nesting of custom C nodes and ArkTS components, a shadow node was introduced to mirror size and properties, allowing child nodes to attach without breaking existing components. Later, content slots were added in HarmonyOS API 12 to eliminate the need for shadow nodes when possible.

3. Text Rendering Performance Optimization

Initial CAPI text measurement and rendering separation revealed that text measurement consumed over 50% of layout time in list scrolling. Subsequent optimizations reused layout artifacts and finally leveraged system text drawing APIs for on‑demand rendering, eliminating re‑layout overhead and adding accessibility and click callbacks.

4. Other Typical Performance and Stability Issues

High‑frequency node creation/release was mitigated with a whitelist/blacklist node reuse strategy. Stability improvements addressed crashes from rapid XComponent creation, misuse of system APIs, and other platform‑specific bugs, resulting in low crash rates after extensive online validation.

KuiklyBase HarmonyOS Adaptation

1. Kotlin Native HarmonyOS Support

Kotlin JS performance was insufficient (Native ≈ 950% faster). The solution compiles Kotlin IR to LLVM 11 (Apple) then links with LLVM 12 (HarmonyOS), avoiding multi‑LLVM complications.

Runtime adaptations added interop files and platform‑specific logic, achieving a 2.48× slowdown compared to iOS, later mitigated with inline, ThreadLocal, and coroutine optimizations.

2. Debugging Efficiency Improvements

A Kotlin LLDB plugin was optimized to cache and reuse debug information, achieving a 40× speed boost. An IDE plugin automates debugging setup, exposing SO artifacts and source files directly within the HarmonyOS IDE, dramatically improving developer workflow.

ComposeDSL Beta Release

The beta adds standard Compose DSL support, extending Kuikly’s rendering layer to Android, iOS, HarmonyOS, Web, and mini‑programs, while preserving dynamic update capabilities and native performance.

Technical Outlook

Future work includes continuous HarmonyOS adaptation, improving Kotlin Native GC to match Java performance, and expanding debugging support to Android Studio for a unified development experience across platforms.

HarmonyOSDebugging ToolsKotlin MultiplatformRendering Enginecross-platform UI
Tencent TDS Service
Written by

Tencent TDS Service

TDS Service offers client and web front‑end developers and operators an intelligent low‑code platform, cross‑platform development framework, universal release platform, runtime container engine, monitoring and analysis platform, and a security‑privacy compliance suite.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.