Thats why I added in the 2nd block's of code. Notice I said I wasn't comparing apples to apples in the first.

If your using a working pointer then your back to pointer math and are basically working with PChars (when dealing with bytes). No sense in actually creating an array and having the extra overhead at that point, instead just allocate the PChar and go. Granted your only talking a SizeOf(SizeInt) difference, but if you have a few 1000 instances that SizeOf adds up quickly.

When I created my generic parser and lexer libraries I spent a lot of time performing tests to see what the fastest method to iterate strings was, PChar always won in size and speed comparisons.

The other nice thing is that AnsiString to PChar casting is lossless where Array to AnsiString or AnsiString to Array causes a mem copy.

I will say that arrays win if you are doing something as follows:[pascal]procedure LoadDataFile(FromFile : AnsiString);
var
fs : TFileStream;
iCount : Integer;
begin
fs := TFileStream.Create(FromFile, fmOpenRead);
try
iCount := fs.Size div SizeOf(TMyRecordType);
SetLength(Data, iCount);
fs.Read(Data[0], iCount * SizeOf(TMyRecordType);
finally
fs.Free;
end;
end;[/pascal]
(that code isn't tested at all LOL)

This is mainly due to the fact that using direct blocks of memory (PChar or pointer) you will have to perform a copy with block reads instead of a single direct read from the origin. Behind the scenes, FPC (and Delphi for that matter) handle these block reads for you in the scenario above and use pointer math to move through the target.

[Edit] PS: Your retort proves my point, any time you can move to pointer access over indexed access its faster. You can go back through everything I posted and change it to Pointer instead of PChar and its the same thing. I'm speaking against indexed access when compared to pointer access. In the end, I believe, we are both saying pointer access is faster than indexed access.