About the author
I have often wanted to point this out, but didn't really feel the need to, until today, when I was debugging into the RTL.
When you have a string parameter, the compiler makes a call to the RTL routine _UStrAddRef, and _UStrClr.When you have multiple string parameters, the compiler makes a call for each string parameter to _UStrAddRef, and one call to _UStrArrayClr. In addition, the compiler will compile code similar to a try finally sequence as well.
If you do not make any changes to the string parameter, it is better to make that string parameter a const.
So, assuming you have the following code pattern:
procedure AName(param1: string)
changing it to:
procedure AName(const param1: string)
reduces the 2 calls generated by the compiler.
Here's the disassembly for the procedure X(S1, S2: string)
and here's the disassembly for Y(const S1, S2: string):
As you can see, without the const, the generated code is more verbose.
A method to design records so that they're allocated on a specific byte boundary, such as 16 bytes, 512 bytes, 4096 bytes, etc.