Clarify Diff Snapshots Freed column is per class #8837 - #10002
Clarify Diff Snapshots Freed column is per class #8837#10002AzazelSensei wants to merge 1 commit into
Conversation
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
There was a problem hiding this comment.
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.
| 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.'; | ||
| } | ||
| } |
There was a problem hiding this comment.
[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
- Extract repeated sub-expressions or string literals within the same method into local variables or constants to adhere to the DRY principle. (link)
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
///).Issues checklist
contributions-welcome] or [good-first-issue] label.contributions-welcome] or [good-first-issue] label. I understand this means my PR might take longer to be reviewed.Tests checklist
The change is header tooltip copy. Existing table code already shows
titleTooltipon hover.AI-tooling checklist
Feature-change checklist
release-notes-not-requiredlabel or left a comment requesting the label be added.packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.No layout change, only column header tooltips, so I did not attach screenshots.