Flutter Oct 2, 2020

Performance testing on the web

Article Summary

Tianguang Zhang from Flutter reveals how to catch performance bugs before they reach production. His automated testing approach measures frame rendering down to the millisecond.

Flutter web apps need rigorous performance testing, but manual testing misses subtle jank. Zhang demonstrates how to automate performance benchmarking using the web_benchmarks package, testing real user scenarios like scrolling, page transitions, and button taps directly in Chrome.

Key Takeaways

Critical Insight

Automated performance testing in Chrome catches frame drops and jank before users experience them, with metrics that track rendering performance across real usage scenarios.

The article includes a complete working example app and shows exactly how Flutter Gallery maintains its performance dashboard.

About This Article

Problem

Flutter developers had trouble spotting performance issues in web apps during development. Manual browser testing doesn't capture frame-by-frame rendering data or jank patterns, which are what actually affect how users experience the app.

Solution

Tianguang Zhang set up automated benchmark tests with the web_benchmarks package. These tests connect to Chrome's DevTools port and collect metrics like preroll time, apply frame time, and total UI frame time. The tests run predefined user gestures such as scrolling and page transitions.

Impact

The framework calculates mean, standard deviation, and outlier ratios for each dataset. This lets developers measure how much noise exists in their performance data. They can then set up CI jobs to block performance-heavy changes from being merged, similar to how Flutter Gallery's dashboard tracks performance over time.