PRF008
Large string concatenation
Object Pascal — Delphi & Free Pascal
Info
Performance
Many concatenation operators on one line cause repeated memory allocations
many concatenation operators on one line cause repeated memory allocations.
Why this severity
many concatenation operators on one line cause repeated memory allocations.
Known false positives
short constant fragments where the compiler may optimize the concatenation.
Remediation example
var
SB: TStringBuilder;
begin
SB := TStringBuilder.Create;
try
SB.Append(A).Append(B).Append(C);
Result := SB.ToString;
finally
SB.Free;
end;
end;Related Performance rules