PRF003
Repeated property access
Object Pascal — Delphi & Free Pascal
Info
Performance
Repeated property getter calls may execute logic each time; caching avoids redundant work
repeated property getter calls may execute logic each time; caching avoids redundant work.
Why this severity
repeated property getter calls may execute logic each time; caching avoids redundant work.
Known false positives
trivial field-backed properties where the compiler inlines the access.
Remediation example
var
Cnt: Integer;
begin
Cnt := List.Count;
for I := 0 to Cnt - 1 do
Process(List[I]);
end;Related Performance rules