[fpc-devel] Performance of string handling in trunk

Michael Schnell mschnell at lumino.de
Wed Jun 26 10:46:36 CEST 2013

On 06/26/2013 09:41 AM, Michael Schnell wrote:
> It shows ... how it is done.

Hi DoDi,

You might be inclined to enhance the test program for me and compile it 
with DXE:

AFAI understand the encoding type and as I see in 
http://wiki.freepascal.org/FPC_Unicode_support :

   TRefStringRec=  packed  record
     Encoding:  word;     // encoding of string
     ElementSize:  byte;  // size in bytes of string's element (1-4)
     Ref:  SizeInt;       // number of references
     Len:  SizeInt;       // number of elements is string

(In fact I suppose that a dummy byte is inserted to prevent that the SizeInt types are misaligned)

The encoding type information should be just before the ref counter and thus adding something like

  v1 := PInteger(j1-12);
  v2 := PInteger(j2-12);

And printing this in hex should show this information.

Now you could test in the newest DXE version what happens when assigning a normal string to a RawByteString and vice versa.

Thanks for helping out...

More information about the fpc-devel mailing list