ovCompose: Achieving High‑Performance Cross‑Platform Mobile Apps
ovCompose is a newly released cross‑platform framework that fully supports HarmonyOS, Android, and iOS, leveraging Kotlin Multiplatform and the native‑focused KuiklyBase to deliver native‑level performance, unified UI rendering, advanced memory and GC optimizations, and a rich component ecosystem, with open‑source repositories for community collaboration.
1. Background: Evolving Cross‑Platform Demands and Challenges
With the launch of pure HarmonyOS, simple UI‑only cross‑platform solutions no longer meet complex business needs. Enterprises need applications that run on Android, iOS, and HarmonyOS to cut development costs and improve efficiency while preserving native performance. Kotlin and Compose are popular for Android, and Kotlin Multiplatform (KMP) offers high performance and flexible native interaction, leading the Tencent Video team to adopt Compose Multiplatform as the foundation.
Initial challenges included lack of HarmonyOS support, limited iOS mixed‑layout capabilities, and average GC performance. The team resolved these issues and decided to open‑source the solution to advance the Compose cross‑platform ecosystem.
2. Core Features and Advantages
2.1 KN High Performance: Native Solution for Ultimate Experience
KuiklyBase provides a native‑based cross‑platform foundation for Kotlin Multiplatform, avoiding the slower JS approach. Leveraging KuiklyBase, ovCompose achieves remarkable performance with Kotlin‑Native (KN) plus Compose.
In a “ball collision” demo at a minimum of 30 FPS, optimized ball count increased from 600 to 1500 (Android up to 1600), a 150 % rendering performance boost.
2.2 HarmonyOS Sandwich Architecture: Solving View Mixed‑Layout
HarmonyOS uses Skia rendering, fully supporting Compose syntax. The sandwich hollow‑structure resolves mixed‑layout with native components, allowing native UI to appear above or below Compose as needed.
The architecture also supports secure components like paste buttons without extra permissions, enhancing both efficiency and security.
2.3 Triple‑Platform Consistency: Unified Logic and UI
Logic runs consistently because HarmonyOS adopts Kotlin‑Native, avoiding thread‑access issues present in Kotlin‑JS. UI rendering uses Skia on iOS, HarmonyOS, and Android, exposing Paragraph/Canvas APIs. Skiko wraps Skia to faithfully reproduce Android drawing, enabling 100 % Compose UI consistency across the three platforms.
2.4 iOS Multimodal Rendering: Unlocking Mixed‑Layout
For iOS, the team created a custom command‑mapping solution that maps Compose to UIKit at the canvas layer, leveraging UIKit’s rich rendering while preserving Compose’s drawing fidelity. This allows runtime switching between the custom mapping and official Skia rendering.
2.5 Kotlin‑Native Memory Optimizations: GC and Heap Dump Breakthroughs
GC Optimization : Short‑term GC suppression during high‑frame‑rate scenarios and reduced GC frequency in low‑impact cases; STW pause compressed to <1 ms using GC suspend capability.
KN Heap Dump Optimization : Asynchronous parent‑child process dump on HarmonyOS eliminates UI freeze; iOS redesign reduces a 450 MB dump from 2.8 s to 410 ms.
2.6 KuiklyBase Component Ecosystem
KuiklyBase offers a rich set of components:
Kotlin Native stack‑trace restoration.
Kotlin Native/ArkTS interop with type conversion and lifecycle management.
Cross‑platform resource management for Android, iOS, and HarmonyOS.
Lightweight atomic operations for thread‑safe concurrency.
Coroutine utilities for async programming.
Efficient, type‑safe serialization.
IO, networking, and other third‑party toolkits.
3. Implementation Details: Deep Technical Exploration
3.1 KN HarmonyOS Adaptation
Kotlin 1.9 uses LLVM 11, Kotlin 2.1 upgrades to LLVM 16, while HarmonyOS supports LLVM 12‑15. KuiklyBase compiles Kotlin IR to LLVM 11 for Apple, then to LLVM 12 for HarmonyOS, avoiding architecture changes.
3.2 KN Performance Optimizations
Inlining : Added always‑inline to address insufficient LLVM inlining on HarmonyOS, fixing CPU‑feature mismatches.
ThreadLocal : Forced hardware thread_local usage, improving memory allocation performance by 30 %.
Coroutine Overhead : Reduced exception handling cost, achieving stable 120 Hz scrolling on long lists.
Debugging Speed : Merged processes and caching in KDS/LLDB, boosting debugging performance to near‑native levels.
3.3 Texture‑Mode Synchronization for HarmonyOS
Using XComponent’s Texture mode, content is rendered to an FBO that participates in ArkUI’s rendering rhythm, eliminating UI gaps caused by unsynchronized layers.
3.4 iOS PictureRecorder Incremental Rendering
Implemented a partial‑update architecture that diffs drawing commands, reducing render time by 13 % on first paint and 56 % on subsequent paints for video playback pages.
3.5 KuiklyUI vs. ovCompose
KuiklyUI : Native‑rendered, static + dynamic modes, high consistency, supports Compose API, H5 and mini‑programs.
ovCompose : Pure Compose Multiplatform API alignment, self‑rendered HarmonyOS adaptation, multimodal iOS rendering for low‑memory devices.
4. Open‑Source Release
The open‑source effort includes five repositories:
ovCompose‑sample – demo of ovCompose and KuiklyBase.
ovCompose‑multiplatform‑core – customized compose‑multiplatform‑core with HarmonyOS and iOS multimodal support.
KuiklyBase‑kotlin – Kotlin‑Multiplatform core with HarmonyOS optimizations.
KuiklyBase‑components – cross‑platform components covering resources, interop, networking, image loading.
KuiklyBase‑platform – HarmonyOS‑adapted official components, now covering ten basic components.
Repository group address: https://github.com/Tencent-TDS
5. Future Plans
Further improve GC performance in real‑world scenarios.
Advance Kotlin‑Native componentization for better reuse.
Enhance developer experience for Kotlin‑Native.
Align iOS UIKit rendering more closely with Skia.
AndroidPub
Senior Android Developer & Interviewer, regularly sharing original tech articles, learning resources, and practical interview guides. Welcome to follow and contribute!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.