* Removed 'inline' attribute from 6 overloaded pos() functions which contain a managed typecast. Inlining it leads to noticeable increase in code size without any sensible speed improvement.

* Added 'const' modifier to the first argument of these functions in order to avoid creating a local copy.

git-svn-id: trunk@20207 -
This commit is contained in:
sergei 2012-02-01 13:34:36 +00:00
parent 2ea60c9daf
commit 7ff76caa73
4 changed files with 16 additions and 13 deletions

View File

@ -19,9 +19,9 @@ Procedure UniqueString (Var S : UnicodeString);external name 'FPC_UNICODESTR_UNI
Function Pos (Const Substr : UnicodeString; Const Source : UnicodeString) : SizeInt;
Function Pos (c : Char; Const s : UnicodeString) : SizeInt;
Function Pos (c : UnicodeChar; Const s : UnicodeString) : SizeInt;
Function Pos (c : RawByteString; Const s : UnicodeString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
Function Pos (c : UnicodeString; Const s : RawByteString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
Function Pos (c : ShortString; Const s : UnicodeString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
Function Pos (const c : RawByteString; Const s : UnicodeString) : SizeInt;
Function Pos (const c : UnicodeString; Const s : RawByteString) : SizeInt;
Function Pos (const c : ShortString; Const s : UnicodeString) : SizeInt;
Function UpCase(const s : UnicodeString) : UnicodeString;
Function UpCase(c:UnicodeChar):UnicodeChar;

View File

@ -1331,19 +1331,21 @@ begin
end;
Function Pos (c : RawByteString; Const s : UnicodeString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
{ DO NOT inline these! Inlining a managed typecast creates an implicit try..finally
block, which is significant bloat without any sensible speed improvement. }
Function Pos (const c : RawByteString; Const s : UnicodeString) : SizeInt;
begin
result:=Pos(UnicodeString(c),s);
end;
Function Pos (c : ShortString; Const s : UnicodeString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
Function Pos (const c : ShortString; Const s : UnicodeString) : SizeInt;
begin
result:=Pos(UnicodeString(c),s);
end;
Function Pos (c : UnicodeString; Const s : RawByteString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
Function Pos (const c : UnicodeString; Const s : RawByteString) : SizeInt;
begin
result:=Pos(c,UnicodeString(s));
end;

View File

@ -20,9 +20,9 @@ Function Pos (Const Substr : WideString; Const Source : WideString) : SizeInt;
Function Pos (c : Char; Const s : WideString) : SizeInt;
Function Pos (c : WideChar; Const s : WideString) : SizeInt;
Function Pos (c : WideChar; Const s : RawByteString) : SizeInt;
Function Pos (c : RawByteString; Const s : WideString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
Function Pos (c : WideString; Const s : RawByteString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
Function Pos (c : ShortString; Const s : WideString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
Function Pos (const c : RawByteString; Const s : WideString) : SizeInt;
Function Pos (const c : WideString; Const s : RawByteString) : SizeInt;
Function Pos (const c : ShortString; Const s : WideString) : SizeInt;
Function UpCase(const s : WideString) : WideString;

View File

@ -712,26 +712,27 @@ begin
pos:=0;
end;
{ DO NOT inline these! Inlining a managed typecast creates an implicit try..finally
block, which is significant bloat without any sensible speed improvement. }
Function Pos (c : WideChar; Const s : RawByteString) : SizeInt;
begin
result:=Pos(c,WideString(s));
end;
Function Pos (c : RawByteString; Const s : WideString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
Function Pos (const c : RawByteString; Const s : WideString) : SizeInt;
begin
result:=Pos(WideString(c),s);
end;
Function Pos (c : ShortString; Const s : WideString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
Function Pos (const c : ShortString; Const s : WideString) : SizeInt;
begin
result:=Pos(WideString(c),s);
end;
Function Pos (c : WideString; Const s : RawByteString) : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
Function Pos (const c : WideString; Const s : RawByteString) : SizeInt;
begin
result:=Pos(c,WideString(s));
end;