Skip to content

Chrome DevTools for coding agents

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

Dominik Inführf8a18c68d4b6
diff --git a/src/processors/HeapSnapshotManager.ts b/src/processors/HeapSnapshotManager.ts
index f2576cc1..11edd783 100644
--- a/src/processors/HeapSnapshotManager.ts
+++ b/src/processors/HeapSnapshotManager.ts
@@ -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};
}