PRF015
Duplicate method call
Object Pascal — Delphi & Free Pascal
Info
Performance
Calling the same function three or more times wastes cycles when the result is stable
calling the same function three or more times wastes cycles when the result is stable.
Why this severity
calling the same function three or more times wastes cycles when the result is stable.
Known false positives
functions with side effects that must be called each time.
Remediation example
var Count: Integer; begin Count := List.GetCount; // reuse Count instead of calling GetCount repeatedly
Related Performance rules