How We Boosted Flutter App Startup Speed by Over 1 Second
This article details the performance challenges of large‑scale Flutter apps and presents a series of practical optimizations—including module‑level hybrid rendering, native‑side data prefetch with FFI, multi‑level caching, and resource compression—that together reduced home‑page startup time by more than one second.
1. Challenges of Flutter Page Performance
Taobao Special Offer version, a Flutter‑based app with over 100 million users, suffers from noticeable startup delays because Flutter loads dynamic libraries and renders UI on a separate thread, causing white‑screen periods and increased time to interactive, especially on low‑end devices.
2. Module‑Level Hybrid – Home Page Optimization
Initially the home page was built entirely with Flutter + DXFlutter, but a regression of about 1 s in launch time was observed due to delayed library binding and heavy template logic. The solution was a mixed stack: native implementation for the initial home recommendation while keeping search tabs in Flutter, avoiding a full native rewrite.
The mixed‑stack introduced a technical challenge because FlutterBoost only supports page‑level hybrid, not module‑level. By creating a custom FlutterWrapperVC that switches FlutterEngine instances based on module visibility and forces window size adjustments, we achieved module‑level hybrid rendering that can host native, Flutter, or WebView modules.
pod LTaoUIKit '0.0.3.89'After applying this container, home‑page startup improved by at least 1 s and the development workflow became more stable.
3. Data Prefetch and FFI – Pure Flutter Page Optimization
For pages built entirely with Flutter, we identified two main bottlenecks: the Flutter‑to‑native bridge (high latency due to thread switches and data encoding) and the lack of early data loading. By moving data prefetch to the native side and exposing the result to Flutter via FFI, we eliminated the bridge overhead.
Android (vivo y67): 80‑100 ms
iOS (iPhone 6): 120‑200 ms
Native‑side prefetch initiates network requests as soon as the native VC/Activity is created. Returned data is cached with an LRU policy (iOS uses a custom cache instead of NSCache) and made available to Flutter through FFI, avoiding repeated encode/decode cycles.
We also introduced multi‑level caching strategies (aggressive, normal, conservative) to balance freshness and performance, and packaged the whole capability as a reusable SDK.
pod LTPrefetch '1.0.1.19'Applying this approach to detail, profile, and shop pages consistently yielded noticeable startup improvements.
4. Other Optimization Practices
Reuse images from the home page for detail pages.
Compress and pre‑store resources such as DX templates, JSON payloads, and images.
Asynchronously load data ahead of time (e.g., preload profile data after login).
Optimize server‑side response time and streamline protocols.
5. Conclusion
The majority of our gains come from higher‑level application optimizations, while lower‑level engine tweaks by the UC team further complement the effort. Future work may involve deeper Dart‑to‑native compilation (Dart2Native) to eliminate JSON encode/decode overhead, potentially shaving another 50 ms off launch time.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Alibaba Cloud Developer
Alibaba's official tech channel, featuring all of its technology innovations.
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.
