How JD Boosted HarmonyOS App Development Using Taro – Architecture & Performance
JD leveraged the Taro cross‑platform framework to build a HarmonyOS native app, detailing the background partnership with Huawei, the technical solution choices, key features like Web‑style development, CSS optimizations, virtual lists, and mixed native modules, and presenting performance gains and future optimization plans.
Background
In January 2024 JD launched a HarmonyOS native application, taking advantage of HarmonyOS NEXT’s full‑scene, native intelligence, and security features to deliver a smoother, smarter, and safer shopping experience. By June the trial version was released on the Huawei AppGallery, and the official version went live on September 11.
Since 2020 JD and Huawei have maintained a strategic partnership, jointly exploring HarmonyOS innovations. As an early flagship partner in the HarmonyOS ecosystem, JD collaborated closely with Huawei to overcome industry‑level adaptation challenges and helped the open‑source cross‑platform framework Taro become the first to support native ArkUI development.
Technical Solution
To meet tight delivery schedules while ensuring performance and user experience, JD evaluated two development approaches for HarmonyOS native apps:
Develop directly with native ArkTS.
Use a cross‑platform framework.
Native ArkTS development posed long development cycles and high maintenance costs for multiple platforms. JD therefore chose the cross‑platform route, adopting Taro—an open‑source framework from JD’s Aotu Lab that enables a single codebase to run on H5, mini‑programs, and HarmonyOS.
Taro’s compilation capability converts an entire Taro project into an independent HarmonyOS app without additional work. It also supports modular packaging of specific pages into native HarmonyOS modules, which JD used for its native app.
The core infrastructure (routing, location, permissions, etc.) is provided by JD Retail’s mpass team, while Taro handles native page rendering and bridges to the infrastructure. Developers simply execute Taro commands to package the project as native modules.
Key Technical Features
Web‑style development for HarmonyOS
Support for common CSS styles, flex layout, pseudo‑classes/elements.
Support for absolute and fixed positioning.
Support for CSS selectors and media queries.
Support for units such as vh, vw, and calc().
Support for CSS variables and safe‑area definitions.
Compilation uses LightningCSS written in Rust, dramatically speeding up CSS parsing and processing.
Runtime processing follows the WebKit engine’s flow, upgrading CSS rule matching and dirty‑checking for better performance.
Fast migration of existing Taro projects
Taro enables low‑cost migration of existing projects to HarmonyOS while preserving high fidelity and performance.
High‑performance rendering
Rendering logic, including components, animations, layout, and measurement, is shifted to a C++ layer, achieving performance comparable to native ArkTS pages. A Yoga layout engine is integrated to handle measurement and layout on the Taro side.
Virtual list and node reuse
Long‑list components (WaterFlow & List) provide lazy loading, pre‑loading, and node reuse to handle large data sets efficiently.
Native‑mixed development
Taro’s API, based on mini‑program conventions, can be extended with native components, allowing seamless mixing of Taro components and native HarmonyOS components within the same page.
Performance Results
After multiple optimizations, JD’s HarmonyOS app achieved notable performance improvements:
Home page render time reduced to 1062 ms, a 23.9 % improvement over the previous ArkTS version.
Detail page render time reduced to 560 ms, a 74.2 % improvement.
The major gain on the detail page stems from a refactored CSSOM module that reduced time spent in CSS parsing and property application.
Professional testing on Huawei’s performance factory confirmed that most pages meet stringent performance acceptance criteria.
Future Plans
JD plans to continue optimizing Taro for HarmonyOS:
Separate JavaScript business logic from the UI thread by launching a dedicated JS thread, preventing UI blockage.
Flatten view nodes by merging non‑layout‑affecting nodes, reducing the number of draw calls.
Enable dynamic updates of pages and features without recompiling or republishing the app.
Conclusion
The JD HarmonyOS native app demonstrates the feasibility and advantages of using Taro for high‑performance, cross‑platform mobile development. It marks a breakthrough for Taro in the HarmonyOS ecosystem and paves the way for broader enterprise adoption.
Aotu Lab
Aotu Lab, founded in October 2015, is a front-end engineering team serving multi-platform products. The articles in this public account are intended to share and discuss technology, reflecting only the personal views of Aotu Lab members and not the official stance of JD.com Technology.
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.
