Recent

Author Topic: fcl-base Contnrs unit uses 'ShortString'  (Read 2266 times)

AlexTP

  • Hero Member
  • *****
  • Posts: 1766
    • UVviewsoft
fcl-base Contnrs unit uses 'ShortString'
« on: January 03, 2022, 11:35:33 am »
Contnrs.TFPHashObjectList

Code: Pascal  [Select][+][-]
  1.     Function Find(const s:shortstring): TObject; {$ifdef CCLASSESINLINE}inline;{$endif}
  2.     Function FindIndexOf(const s:shortstring): Integer; {$ifdef CCLASSESINLINE}inline;{$endif}
  3.     Function FindWithHash(const AName:shortstring;AHash:LongWord): Pointer;
  4.     Function Rename(const AOldName,ANewName:shortstring): Integer; {$ifdef CCLASSESINLINE}inline;{$endif}
  5.  

These Find* methods are used in fcl-JSON package. So we have slowdown in TJSONObject.Find() 8 overloads, which use 'string' param. Conversion AnsiString--ShortString.
Can it be faster?

Thaddy

  • Hero Member
  • *****
  • Posts: 11517
Re: fcl-base Contnrs unit uses 'ShortString'
« Reply #1 on: January 05, 2022, 01:20:16 pm »
Add {$macro on}{$define shortstring := AnsiString} ?
« Last Edit: January 05, 2022, 01:50:35 pm by Thaddy »
Путин преступник. Россияне дезинформированы.

AlexTP

  • Hero Member
  • *****
  • Posts: 1766
    • UVviewsoft
Re: fcl-base Contnrs unit uses 'ShortString'
« Reply #2 on: January 05, 2022, 01:53:06 pm »
@Thaddy,
but I have precompiled FPC source - your suggestion is to recompile the FPC.
« Last Edit: January 05, 2022, 04:25:59 pm by Alextp »

Thaddy

  • Hero Member
  • *****
  • Posts: 11517
Re: fcl-base Contnrs unit uses 'ShortString'
« Reply #3 on: January 05, 2022, 04:15:07 pm »
Correct. But your biggest project is so complex that I am not able (quickly) to test if it really works.
I would add a define btw and in just an include file, so you would be able to also compile for standard fpc.
Путин преступник. Россияне дезинформированы.

 

TinyPortal © 2005-2018