QQ 9 Performance Optimization: Technical Implementation Behind the "Silky Smooth" Experience
QQ 9 achieves a “silky smooth” experience by cutting launch time 40% through lazy‑loaded libraries and main‑thread priority tweaks, boosting runtime fluidity with an NT Kernel that offloads logic, incremental diff refreshes and parallel layout, and adding the Hodor anti‑degradation system, delivering 35% smoother performance and 48% less lag.
This article provides an in-depth technical analysis of QQ 9's performance optimization journey, revealing the engineering efforts behind its "silky smooth" user experience.
1. Launch Speed Optimization
The iOS launch process is divided into three phases: T0 (icon tap to main function), T1 (main to didFinishLaunchingWithOptions), and T2 (to first frame rendering). For pre-main optimization, QQ 9 implemented lazy loading of dynamic libraries using __attribute__((objc_runtime_visible)) for low-cost code dynamic transformation and objc_setHook_getClass for entry convergence. This contributed approximately 33% of total launch time improvement.
For post-main optimization, the team addressed main thread preemption issues (where main thread CPU time slices were being stolen by other threads, reaching 14% in severe cases). Solutions included: reducing child thread count by using target_queue for queue hierarchy; lowering child thread QoS (Quality of Service); and improving main thread priority through RunLoop task splitting.
2. Runtime Smoothness Optimization
QQ 9 introduced the NT Kernel architecture, which separates business logic from the UI main thread and uses async calls instead of thread locks. The team replaced full-refresh with incremental-refresh, implementing a custom Diff algorithm based on the Heckel algorithm (superior to Myers algorithm with O(m+n) complexity vs O((m+n)*d)).
Additional optimizations include: parallel pre-layout using M executors for N messages (reducing layout calculation time by ~76%); async rendering using multi-core CPU to reduce GPU overhead; intelligent preloading and message recycling; and LRU caching with incremental refresh to solve "flash white" issues.
3. Anti-Degradation System (Hodor)
A three-year developed system providing: trunk merge gate checks; daily automatic ticket generation; performance data dashboards; and alert robots. Based on Instruments dynamic tracing technology and xctrace for automatic trace file parsing.
Results: Using Xcode Organizer, QQ 9 achieved 35% improvement in smoothness (50th percentile), 48% reduction in lag rate, and 40% reduction in launch time compared to previous versions.
Tencent Cloud Developer
Official Tencent Cloud community account that brings together developers, shares practical tech insights, and fosters an influential tech exchange community.
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.