Skip to content

Diff heap statistics. #4501

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

Merged
merged 171 commits into from
Sep 22, 2022
Merged

Diff heap statistics. #4501

merged 171 commits into from
Sep 22, 2022

Conversation

polina-c
Copy link
Contributor

No description provided.

@polina-c polina-c marked this pull request as ready for review September 21, 2022 21:35
Comment on lines +49 to +51
if (other.runtimeType != runtimeType) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be captured by the other is _HeapCouple check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied it from https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#common-boilerplates-for-operator--and-hashcode.
I would stay with the standard.
Maybe is is more expensive and we want to exit early?

if (!isProcessing && current.heap != null) ...[
_DiffDropdown(
current: current,
list: controller.snapshots,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a nice polish could be to remove current from the diff drop down list, so we only show things you're interested in diffing against (no point in diffing current against current)

Copy link
Contributor Author

@polina-c polina-c Sep 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use 'current' as place holder for the option to not diff the snapshot at all. And I replace the name of snapshot wit '-':

I think it creates a nice visual mapping between list at the left and list in dropdown:

Screen Shot 2022-09-21 at 4 33 42 PM

} else {
final heap1 = item.heap!;
final heap2 = item.diffWith.value!.heap!;
stats = controller.diffStore.compare(heap1, heap2).stats;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this can be expensive, we shouldn't do this in build. If it is expensive, we could do this in the controller before we set isProcessing to false (that way we still show a loading spinner while we are calculating this).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is ok for small applications.
And it may be ok for performance, but heavy for memory.
I need to experiment with Gallery.
Added to the issue so that we do not forget: #3949 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this has the potential to slow down the UI at all, we should definitely ship it out to a future and have the UI with a future builder and a spinner or something :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Added TODO and item to #3949 (comment)

abstract class DiffListItem extends DisposableController {
/// Number, that, if shown in name, should be unique in the list.
///
/// If the number is not shown, it should be 0.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part of the comment is a bit confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated. does it help?

} else {
final heap1 = item.heap!;
final heap2 = item.diffWith.value!.heap!;
stats = controller.diffStore.compare(heap1, heap2).stats;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this has the potential to slow down the UI at all, we should definitely ship it out to a future and have the UI with a future builder and a spinner or something :)

Comment on lines 67 to 69
final _diffWith = ValueNotifier<SnapshotListItem?>(null);
ValueListenable<SnapshotListItem?> get diffWith => _diffWith;
void setDiffWith(SnapshotListItem? value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment around ordering. Also, any reason we aren't using a formal setter here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed ordering
formal setter wants to have the same type as the formal getter with the same name

@@ -61,6 +62,9 @@ class DiffPaneController {
}

Future<void> clearSnapshots() async {
for (var i = 0; i < snapshots.value.length; i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use for (final snapshot in snapshots) to make this less verbose

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The index should start with 1 here. Fixed.

@polina-c polina-c merged commit 6f08b6c into flutter:master Sep 22, 2022
@polina-c polina-c deleted the details4 branch September 22, 2022 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants