The object-heavy graph representation was replaced
with Compressed Sparse Row (CSR) data layout. Graph
connectivity is represented by two primitive arrays:
int[] offsetArray
int[] edgeArray
For a node, the offset array identifies the contiguous
range of its outgoing edges:
start = offsetArray[nodeId]
end = offsetArray[nodeId + 1]
The corresponding range in edgeArray contains neighboring
node identifiers. Traversal therefore uses array indexing
and sequential access through primitive data instead of
following chains of Java object references.
Frequently accessed metric values are stored separately
in a primitive long[] metricsArray. This array serves
metric access; it is not part of the CSR connectivity
structure defined by offsetArray and edgeArray.
The CSR representation improves spatial locality and
provides a more predictable access pattern for the
processor's memory hierarchy and hardware prefetching.
It does not imply that every neighborhood fits into a
single cache line.
Dynamic topology changes are handled separately from
metric refreshes. A structural change builds a new CSR
topology snapshot asynchronously. The topology arrays
are not modified after publication, so a traversal can
continue using its existing snapshot while the next
version is being prepared.
Once the new topology snapshot is ready, an
AtomicReference publishes it through an atomic reference
replacement. Each traversal retains a local reference
to the snapshot with which it started, so the topology
it reads remains structurally stable throughout that
traversal.
Retired topology snapshots become eligible for garbage
collection after no active references remain. This
avoids requiring traversal threads to wait for in-place
reconstruction of the graph topology.
Frequently changing metrics are updated in-place using
atomic primitives rather than rebuilding the topology
for every telemetry update. Individual atomic updates
do not imply that all metrics represent one
transactionally consistent instant in time. The design
preserves structural topology consistency while allowing
telemetry values to evolve continuously.
Traversal state was moved into preallocated primitive
working buffers. Temporary collections, iterator objects
and other per-execution helper allocations were removed
from the measured hot path.
The allocation result is scoped to measured
application-level traversal allocation. It does not
mean that the JVM or the entire application performed
zero allocation; the quantified result is reported
separately in the measured results.