Back

LL098

Triple nested loop

Object Pascal — Delphi & Free Pascal
Warning
Complexity

Three levels of nested loops create O(n^3) complexity and are difficult to reason about

three levels of nested loops create O(n^3) complexity and are difficult to reason about.

Why this severity

three levels of nested loops create O(n^3) complexity and are difficult to reason about.


Known false positives

matrix or tensor operations that inherently require multiple loop dimensions.

Remediation example

procedure ProcessRows(const Data: TMatrix);
begin
  for I := 0 to RowCount - 1 do
    ProcessSingleRow(Data, I);
end;

Reconnecting… Connection lost. Reload