There is existing tooling to trace all widget build times in the performance page but it requires users to know it exist, know when to use it, and search through the flame chart for actionable data.
Instead we should prompt users when they should enable the functionality, and surface when there are build times that are slow enough to be considered anti-patterns.
Suggested flow:
- Surface warnings in DevTools suggesting that users enable trackWidgetBuilds whenever the widget build time was measured to be above some threshold.
- When trackWidgetBuilds is enabled, surface warnings when specific widget build times are above some threshold (in profile mode). Warnings could be for both inclusive (includes subtree) and exclusive (widget only) build times. For example, a widget that does expensive HTML parsing could show an expensive exclusive build time. Inclusive build times could be skewed by reasonable widgets that just happen to render a very large amount of complex content.
Open questions:
- Do we need to disambiguate excessive time spent in initState or just build methods?
- Are the exclusive cases better covered by the existing bottom up view of the cpu profiler view?
- Should we seek tooling that works on the command line to warn about very slow build methods even without launching DevTools?
There is existing tooling to trace all widget build times in the performance page but it requires users to know it exist, know when to use it, and search through the flame chart for actionable data.
Instead we should prompt users when they should enable the functionality, and surface when there are build times that are slow enough to be considered anti-patterns.
Suggested flow:
Open questions: