Skip to content

Workflow to nudge users to fix common initState and build anti-patterns #3483

Description

@jacob314

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:

  1. Surface warnings in DevTools suggesting that users enable trackWidgetBuilds whenever the widget build time was measured to be above some threshold.
  2. 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:

  1. Do we need to disambiguate excessive time spent in initState or just build methods?
  2. Are the exclusive cases better covered by the existing bottom up view of the cpu profiler view?
  3. Should we seek tooling that works on the command line to warn about very slow build methods even without launching DevTools?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3issues we think are valid but not importantcost: mediumMedium engineering cost to implementcustomer: money (g3)screen: performanceIssues with the Performance screen

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions