-
Notifications
You must be signed in to change notification settings - Fork 362
Add setting for tracking user-created widget builds #4010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add setting for tracking user-created widget builds #4010
Conversation
| import '../../ui/service_extension_widgets.dart'; | ||
| import 'performance_screen.dart'; | ||
|
|
||
| class EnhanceTracingButton extends StatelessWidget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this class was moved over from performance_screen.dart with a couple changes (marked below)
| SecondaryPerformanceControls.minScreenWidthForTextBeforeScaling, | ||
| extensions: [ | ||
| extensions.profileWidgetBuilds, | ||
| extensions.profileUserWidgetBuilds, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line was added
| customExtensionUi: { | ||
| extensions.profileWidgetBuilds.extension: | ||
| const TrackWidgetBuildsSetting(), | ||
| extensions.profileUserWidgetBuilds.extension: const SizedBox(), | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these lines were added
CoderDake
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried my best to look over this, but I think I'm still a bit too green to fully understand and approve this.
That being said I learned a lot reading it, and only found a couple of small things to comment on.
packages/devtools_app/lib/src/ui/service_extension_widgets.dart
Outdated
Show resolved
Hide resolved
| final _trackWidgetBuildsExtensions = [ | ||
| extensions.profileWidgetBuilds, | ||
| extensions.profileUserWidgetBuilds, | ||
| ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| final _trackWidgetBuildsExtensions = [ | |
| extensions.profileWidgetBuilds, | |
| extensions.profileUserWidgetBuilds, | |
| ]; | |
| final _trackWidgetBuildsExtensions = { | |
| TrackWidgetBuildsScope.all: extensions.profileWidgetBuilds, | |
| TrackWidgetBuildsScope.userCreated: extensions.profileUserWidgetBuilds, | |
| }; |
Having an ordering depending on the enum value index feels scary at first glance. Perhaps changing this to a map, or setting based on the index explicitly could be less comment dependent approaches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a list can save space since with a map, we are keeping a set of keys in memory that we do not actually need. But for this case, since it is small, I have replaced with a map for improved readability.
|
How expensive is it to enable TWB for the user code? I wonder if DevTools should just enable it as soon as the user opens the Performance page. Maybe this depends on project size? |
|
@InMatrix I did a lot of work to try to make it faster to the point were we could enable it by default. The problem is that anytime I made it faster, I also made the baseline faster. The cost varies project to project but in our benchmarks we were seeing a 17% increase in build time with it on: flutter/flutter#100926 (comment) That makes it not a good candidate to always be on, but maybe you are right that it might make make sense if people are actively looking at performance. |
CC @InMatrix @ayanogawa
CC @gaaclarke
Fixes #3966