How We Boosted a WeChat Mini‑Program’s Audit Score from 68 to 100
This article walks through a systematic performance audit of the Jingxi Mini‑Program, identifies seven key penalty items—including excessive WXML nodes, oversized images, tiny tap targets, redundant network calls, and unbound data—and details concrete optimizations that reduced the audit score to a perfect 100.
Background
The Audits feature in WeChat Developer Tools evaluates Mini‑Program performance in real time, identifying issues that affect user experience and providing optimization suggestions. The Jingxi Mini‑Program, a high‑traffic JD business, initially scored 68 points, prompting a systematic analysis of the audit metrics.
Current Audit Results
Running Audits in the debugger showed a total score of 68 with deductions across performance, best practices, and user experience, resulting in eight distinct penalty items.
Penalty Item 1 – Excessive WXML Nodes
Scoring rule: Fewer than 1,000 nodes, tree depth under 30 layers, and no more than 60 child nodes per parent.
The homepage contained over 2,500 nodes, increasing memory usage and layout recalculation time. The team applied a control‑variable method: hide one module at a time, record the node count, and compute each module’s contribution.
Two main screens (first‑screen and second‑screen) were identified, with the list module accounting for the majority of nodes.
Load page elements on demand, rendering only when visible.
Reduce the number of items in long lists.
A pagination proxy was introduced to fetch only five items per request instead of the original twenty. The proxy maintains a full data set locally and serves the required page on demand.
After applying lazy loading and the pagination proxy, the total WXML node count dropped below the 1,000‑node threshold.
Penalty Item 2 – Oversized Images
Scoring rule: Image width × height must not exceed the displayed area multiplied by the square of the device pixel ratio.
Large images displayed in small containers waste bandwidth and memory. The solution is to request appropriately sized images from the CDN based on the element’s dimensions.
Additional recommendations:
Prefer WebP over JPG/PNG/GIF for better compression on supported Android devices.
Compress PNGs with tools such as TinyPNG (https://tinypng.com/) to reduce size with minimal quality loss.
Penalty Item 3 – Small Tap Targets
Scoring rule: Clickable elements must be at least 20 px wide and high.
Increase the interactive area using CSS properties such as padding, border, or box-shadow.
Penalty Item 4 – Missing Request Caching
Scoring rule: Identical URL requests within three minutes must not exceed 128 KB and must not return duplicate content.
Cache responses in Mini‑Program storage with proper expiration handling, and add random query parameters or timestamps to logs that truly need repeated fetching.
Penalty Item 5 – Excessive Concurrent Requests
Scoring rule: wx.request calls taking longer than 300 ms must not exceed ten concurrent requests; wx.connectSocket connections are limited to five.
Optimization strategies include moving calculation logic to the server, aggregating similar requests, and throttling rapid bursts of calls.
Penalty Item 6 – Unbound Variables in WXML
Scoring rule: Every field passed to setData must be referenced in the template.
Separate non‑UI state into a private object (e.g., this.privateData) or use the “pure data fields” feature to keep such data out of the rendering pipeline. For legacy code where this is not feasible, a workaround is to bind a dummy list to force the framework to treat the variable as used.
Penalty Item 7 – Too Many Image Requests
Scoring rule: Concurrent image requests to the same domain that exceed 100 ms must not surpass twenty.
Mitigation techniques:
Combine multiple icons into a sprite sheet.
Enable lazy loading with the Mini‑Program Image component’s lazy-load attribute, or implement a custom lazy‑load component.
Result
After implementing the above optimizations, the audit was rerun and the Jingxi homepage achieved a perfect 100‑point score, demonstrating the practical impact of systematic performance tuning.
References
[1] Mini‑Program Development Docs: https://developers.weixin.qq.com/miniprogram/dev/framework/quickstart/
[2] Image performance article: https://searchengineland.com/images-easiest-page-speed-win-269742
[3] TinyPNG compression service: https://tinypng.com/
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.
