Skip to content

Clarify Diff Snapshots Freed column is per class #8837 - #10002

Open
AzazelSensei wants to merge 1 commit into
flutter:masterfrom
AzazelSensei:docs-8837-freed-column-tooltip
Open

Clarify Diff Snapshots Freed column is per class #8837#10002
AzazelSensei wants to merge 1 commit into
flutter:masterfrom
AzazelSensei:docs-8837-freed-column-tooltip

Conversation

@AzazelSensei

Copy link
Copy Markdown

The Diff Snapshots size columns already report each class on its own row. Freed had no header tooltip, so 29.9MB looked like it might be a running total.

I added tooltips on Allocated, Freed, Delta, and Persisted that say the value is for that class row.

Fixes #8837

Pre-launch Checklist

General checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read the [Flutter Style Guide] recently, and have followed its advice.
  • I signed the [CLA].
  • I updated/added relevant documentation (doc comments with ///).

Issues checklist

  • I listed at least one issue that this PR fixes in the description above.
  • I listed at least one issue which has the [contributions-welcome] or [good-first-issue] label.
  • I did not list at least one issue with the [contributions-welcome] or [good-first-issue] label. I understand this means my PR might take longer to be reviewed.

Tests checklist

  • I added new tests to check the change I am making...
  • OR there is a reason for not adding tests, which I explained in the PR description.

The change is header tooltip copy. Existing table code already shows titleTooltip on hover.

AI-tooling checklist

  • I did not use any AI tooling in creating this PR.
  • OR I did use AI tooling, and...
    • I read the [AI contributions guidelines] and agree to follow them.
    • I reviewed all AI-generated code before opening this PR.
    • I understand and am able to discuss the code in this PR.
    • I have verifed the accuracy of any AI-generated text included in the PR description.
    • I commit to verifying the accuracy of any AI-generated code or text that I upload in response to review comments.

Feature-change checklist

  • This PR does not change the DevTools UI or behavior and...
    • I added the release-notes-not-required label or left a comment requesting the label be added.
  • OR this PR does change the DevTools UI or behavior and...
    • I added an entry to packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.
    • I included before/after screenshots and/or a GIF demo of the new UI to my PR description.
    • I ran the DevTools app locally to manually verify my changes.

No layout change, only column header tooltips, so I did not attach screenshots.

The Freed (and Allocated / Delta / Persisted) size columns already
show that class only. Add header tooltips so it is not read as a
running total of the table.

Fixes flutter#8837

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds tooltips to the size columns (Allocated, Freed, Delta, Persisted) in the Memory Diff Snapshots table to clarify that the values represent individual rows rather than cumulative totals. The release notes have also been updated. The reviewer suggested extracting a repeated string literal in the new columnTooltip method into a local constant to adhere to the DRY principle.

Comment on lines +187 to +203
static String columnTooltip(_DataPart dataPart) {
switch (dataPart) {
case _DataPart.created:
return 'Size of this class allocated between the two snapshots.\n'
'This is the value for this row, not a cumulative total.';
case _DataPart.deleted:
return 'Size of this class released between the two snapshots.\n'
'This is the value for this row, not a cumulative total.';
case _DataPart.delta:
return 'Net size change of this class between the two snapshots '
'(allocated minus freed).\n'
'This is the value for this row, not a cumulative total.';
case _DataPart.persisted:
return 'Size of this class present in both snapshots.\n'
'This is the value for this row, not a cumulative total.';
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

[CONCERN] The string literal '\nThis is the value for this row, not a cumulative total.' is repeated four times within the columnTooltip method. To adhere to the DRY principle and the repository style guide, this repeated sub-expression should be extracted into a local constant.

  static String columnTooltip(_DataPart dataPart) {
    const rowValueNote = '\\nThis is the value for this row, not a cumulative total.';
    switch (dataPart) {
      case _DataPart.created:
        return 'Size of this class allocated between the two snapshots.$rowValueNote';
      case _DataPart.deleted:
        return 'Size of this class released between the two snapshots.$rowValueNote';
      case _DataPart.delta:
        return 'Net size change of this class between the two snapshots '
            '(allocated minus freed).$rowValueNote';
      case _DataPart.persisted:
        return 'Size of this class present in both snapshots.$rowValueNote';
    }
  }
References
  1. Extract repeated sub-expressions or string literals within the same method into local variables or constants to adhere to the DRY principle. (link)

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.

Question - Clarifying the 'Freed' Column: Cumulative Total or Per-Row Memory?

1 participant