View Issue Details

IDProjectCategoryView StatusLast Update
0030960FPCRTLpublic2016-11-26 18:29
ReporterAlexey Tor.Assigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version3.1.1Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0030960: Sysutils funcs need "inline"
DescriptionI found simple funcs, for "inline"
Additional Informationfunction LoadStr(Ident: integer): string;
begin
  result:='';
end ;

Function Format (Const Fmt : AnsiString; const Args : Array of const) : AnsiString;
begin
  Result:=Format(Fmt,Args,DefaultFormatSettings);
end;

Function FormatBuf (Var Buffer; BufLen : Cardinal;
                     Const Fmt; fmtLen : Cardinal;
                     Const Args : Array of const) : Cardinal;
begin
  Result:=FormatBuf(Buffer,BufLen,Fmt,FmtLen,Args,DefaultFormatSettings);
end;

Procedure FmtStr(Var Res: string; const Fmt : string; Const args: Array of const; Const FormatSettings: TFormatSettings);
begin
  Res:=Format(fmt,Args,FormatSettings);
end;

Procedure FmtStr(Var Res: String; Const Fmt : String; Const args: Array of const);
begin
  FmtStr(Res,Fmt,Args,DefaultFormatSettings);
end;

Function StrFmt(Buffer,Fmt : PChar; Const args: Array of const) : Pchar;

begin
  Result:=StrFmt(Buffer,Fmt,Args,DefaultFormatSettings);
end;

Function StrLFmt(Buffer : PCHar; Maxlen : Cardinal;Fmt : PChar; Const args: Array of const) : Pchar;

begin
  Result:=StrLFmt(Buffer,MaxLen,Fmt,Args,DefaultFormatSettings);
end;

Function StrToFloat(Const S: String): Extended;

begin
  Result:=StrToFloat(S,DefaultFormatSettings);
end;

function StrToFloatDef(const S: string; const Default: Extended): Extended;

begin
  Result:=StrToFloatDef(S,Default,DefaultFormatSettings);
end;

Function TextToFloat(Buffer: PChar; Out Value: Extended): Boolean;

begin
  Result:=TextToFloat(Buffer,Value,DefaultFormatSettings);
end;

Function TextToFloat(Buffer: PChar; Out Value; ValueType: TFloatValue): Boolean;

begin
  Result:=TextToFloat(Buffer,Value,ValueType,DefaultFormatSettings);
end;

Function TryStrToFloat(Const S : String; Out Value: Single): Boolean;

begin
  Result:=TryStrToFloat(S,Value,DefaultFormatSettings);
end;

Function TryStrToFloat(Const S : String; Out Value: Single; Const FormatSettings: TFormatSettings): Boolean;
Begin
  Result := TextToFloat(PChar(pointer(S)), Value, fvSingle,FormatSettings);
End;

Function TryStrToFloat(Const S : String; Out Value: Double): Boolean;

begin
  Result:=TryStrToFloat(S,Value,DefaultFormatSettings);
end;

Function TryStrToFloat(Const S : String; Out Value: Double; Const FormatSettings: TFormatSettings): Boolean;
Begin
  Result := TextToFloat(PChar(pointer(S)), Value, fvDouble,FormatSettings);
End;

Function TryStrToFloat(Const S : String; Out Value: Extended): Boolean;

begin
  Result:=TryStrToFloat(S,Value,DefaultFormatSettings);
end;

Function TryStrToFloat(Const S : String; Out Value: Extended; Const FormatSettings: TFormatSettings): Boolean;
Begin
  Result := TextToFloat(PChar(pointer(S)), Value,FormatSettings);
End;

Function FloatToStr(Value: Extended): String;

begin
  Result:=FloatToStr(Value,DefaultFormatSettings);
end;

Function FloatToStr(Value: Currency): String;

begin
  Result:=FloatToStr(Value,DefaultFormatSettings);
end;

Function FloatToStr(Value: Double): String;

begin
  Result:=FloatToStr(Value,DefaultFormatSettings);
end;

Function FloatToStr(Value: Single): String;

begin
  Result:=FloatToStr(Value,DefaultFormatSettings);
end;

Function FloatToStr(Value: Comp): String;

begin
  Result:=FloatToStr(Value,DefaultFormatSettings);
end;

Function FloatToStr(Value: Int64): String;

begin
  Result:=FloatToStr(Value,DefaultFormatSettings);
end;

Function FloatToStrF(Value: Extended; format: TFloatFormat; Precision, Digits: Integer; Const FormatSettings: TFormatSettings): String;
begin
  Result := FloatToStrFIntl(value,format,precision,digits,fvExtended,FormatSettings);
end;


Function FloatToStrF(Value: Extended; format: TFloatFormat; Precision, Digits: Integer): String;

begin
  Result:=FloatToStrF(Value,Format,Precision,Digits,DefaultFormatSettings);
end;

(some others also exist, see sysstr.inc below FloatToStrF)
TagsNo tags attached.
Fixed in Revision34970
FPCOldBugId
FPCTarget
Attached Files

Activities

Sergei Gorelkin

2016-11-20 03:03

developer   ~0096065

What's the point of inlining every function that is 1 line long?
For function dealing with strings, performance improvements from eliminating a call are insignificant.
OTOH, inlining load of DefaultFormatSettings (and other global symbols) bloats code and relocation table sizes. On targets like powerpc64, referencing a global symbol can take up to 6 instructions.

Alexey Tor.

2016-11-20 03:40

reporter   ~0096066

I agree, so at last, skip funcs, which refer to glob symbol

Michael Van Canneyt

2016-11-26 18:29

administrator   ~0096262

Only Loadstr() is now inlined, since all others reference a global symbol...

Issue History

Date Modified Username Field Change
2016-11-20 00:42 Alexey Tor. New Issue
2016-11-20 00:53 Michael Van Canneyt Assigned To => Michael Van Canneyt
2016-11-20 00:53 Michael Van Canneyt Status new => assigned
2016-11-20 03:03 Sergei Gorelkin Note Added: 0096065
2016-11-20 03:40 Alexey Tor. Note Added: 0096066
2016-11-26 18:29 Michael Van Canneyt Fixed in Revision => 34970
2016-11-26 18:29 Michael Van Canneyt Note Added: 0096262
2016-11-26 18:29 Michael Van Canneyt Status assigned => resolved
2016-11-26 18:29 Michael Van Canneyt Fixed in Version => 3.1.1
2016-11-26 18:29 Michael Van Canneyt Resolution open => fixed
2016-11-26 18:29 Michael Van Canneyt Target Version => 3.2.0