runStep

protected open override fun runStep()(source)

Advances algorithm state, then constructs and routes a snapshot only when a consumer actually needs it.

Consumer check — evaluated once per iteration:

val needsStep = saveSteps || stepEmitter.isObserved

When false: tight arithmetic loop with zero per-iteration heap allocation. When true:

  • myCurrentStep is set (feeds Observable notification from IterativeProcess).

  • If saveSteps: snapshot appended to _steps.

  • If stepEmitter.isObserved and step matches snapShotFrequency: snapshot emitted.