feat: Sort objects for class by self size in compare_heapsnapshots (#3205)

Show the most significant objects first for a class in
`compare_heapsnapshots`.
This commit is contained in:
Dominik Inführ authored and GitHub committed 2026-10-16 12:36:41 +00:00
1 parent fb8375bd2d
commit f8a18c68d4
1 file changed
+3
+3
View File
@@ -391,6 +391,9 @@ export class HeapSnapshotManager {
for (const [i, id] of deletedIds.entries()) {
objects.push({id, selfSize: deletedSelfSizes[i], change: 'deleted'});
}
// Largest objects first so that the first page of paginated output shows
// the most significant changes.
objects.sort((a, b) => b.selfSize - a.selfSize);
return {classDiff: toClassDiff(classIndex, rawDiff), objects};
}