Anders said in another thread ...
Hi Anders.
Thanks for the feedback, much appreciated.
Yes, I have profiled my Clipper library's Delphi code (and not infrequently), but until now I haven't profiled into Delphi's Runtime Library.
And I see your point re TList.Get, if you're alluding to its relatively expensive range checking?
However, I can't see an easy hack (eg by overriding Get, since it isn't virtual).
But I could write a wrapper Get function (using TList's public List property) and bypass the default TList.items property altogether.
Is this what you're suggesting, or would you suggest I do something else?
And are you also seeing other "low hanging fruit" that would improve performance?
Edit:
I've replaced all implicit calls to TList.Get with the following function and as a consequence have seen quite a substantial improvement in performance (and Delphi now slightly out-performs C#).
function UnsafeGet(List: TList; Index: Integer): Pointer; inline;
begin
// caution: no bounds checking
Result := List.List[Index];
end;