resizeScratchArrays method

void resizeScratchArrays(
  1. int capacity
)

Pre-allocates scratch arrays for capacity nodes. Useful when the tree size is known upfront to avoid incremental resizing.

Implementation

void resizeScratchArrays(int capacity) {
  if (capacity <= 0) {
    _depthScratch = Int32List(0);
    _stablePrefix = Float64List(0);
    _subtreeEndIndex = Int32List(0);
    _subtreeBottomByIndex = Float64List(0);
  } else {
    _depthScratch = Int32List(capacity);
    _stablePrefix = Float64List(capacity + 1);
    _subtreeEndIndex = Int32List(capacity);
    _subtreeBottomByIndex = Float64List(capacity);
  }
}