dart-sdk/pkg/vm_service/lib
Martin Kustermann 6b1e9bbdfe Extend HeapSnapshotGraph API to support incoming references in package:vm_service
Currently the HeapSnapshotGraph represents the objects in the Dart VM
heap and how they relate to each other. They effectively form a directed
graph with a specific root node.

The API does allow traversing the graph by following an object's
outgoing references.

Though in certain situations it can be very useful to know the set of
objects referencing a given object (i.e. incoming references).

This CL adds such support, thereby allowing traversing edges in both
directions: Finding what an object references and who references an
object.

When loading a snapshot we therefore have to also compute the reverse
edges and store them. To offset any additional computation time and
memory consumption, we optimize the existing implementation by not using
growable List<int> objects for outgoing edges but rather typed-data
views into the existing Uint32List of edges.

Due to this optimization we make loading of snapshot faster and smaller,
in a simple benchmark we seem to get:

  * JIT: 10% faster, 40% less RAM
  * AOT: 30% faster, 40% less RAM

despite the additional compute & data structures of this API.

TEST=vm/dart{,_2}/heap_snapshot_referencees_test

Change-Id: Ief30bfb58c70364744eeb7f69967dd1f72ece807
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260524
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-09-23 10:11:41 +00:00
..
src Extend HeapSnapshotGraph API to support incoming references in package:vm_service 2022-09-23 10:11:41 +00:00
utils.dart [ package:vm_service] Output null-safe code from package:vm_service code generator 2021-01-08 21:19:38 +00:00
vm_service.dart [ package:vm_service ] Export dart:io service extensions through package_vm_service 2020-01-03 18:47:59 +00:00
vm_service_io.dart [ package:vm_service] Output null-safe code from package:vm_service code generator 2021-01-08 21:19:38 +00:00