FPC is much slower than Turbo Delphi with the same Json library
Original Reporter info from Mantis: jixian.yang
-
Reporter name: yang jixian
Original Reporter info from Mantis: jixian.yang
- Reporter name: yang jixian
Description:
procedure TForm1.Log(astr: string);
begin
Memo1.Lines.Add(astr);
end;
procedure TForm1.TestSO;
var jo: ISuperObject; i: Int64; a: DWORD;
begin
jo := SO();
i := 0;
a := GetTickCount;
while i < cstMaxTest do begin
jo.S['Name'] := 'This is a Str' + IntToStr(i);
jo.I['Age'] := i;
jo.O['List'] := SO('[1,"Hello",5,{"name":"c5soft","age":50}]');
if i = 100 then
Log('SO:' + jo.AsJSon());
inc(i);
end;
Log('SuperObject: ' + IntToStr(GetTickCount - a));
end;
procedure TForm1.TestMJ;
var jo: Variant; i: Int64; a: DWORD;
begin
TDocVariant.New(jo); ;
i := 0;
a := GetTickCount;
while i < cstMaxTest do begin
jo.Name := 'This is a Str' + IntToStr(i);
jo.Age := i;
jo.List:=_JSon('[1,"Hello",5,{"name":"c5soft","age":50}]');
if i = 100 then
Log('MJ:' + VariantSaveJSON(jo));
inc(i);
end;
Log('mORMot JS: ' + IntToStr(GetTickCount - a));
end;
FPC:
MJ:{"Name":"This is a Str100","Age":100,"List":[1,"Hello",5,{"name":"c5soft","age":50}]}
mORMot JS: 437
SO:{"Age":100,"Name":"This is a Str100","List":[1,"Hello",5,{"age":50,"name":"c5soft"}]}
SuperObject: 2730
MJ:{"Name":"This is a Str100","Age":100,"List":[1,"Hello",5,{"name":"c5soft","age":50}]}
mORMot JS: 437
SO:{"Age":100,"Name":"This is a Str100","List":[1,"Hello",5,{"age":50,"name":"c5soft"}]}
SuperObject: 2730
Turbo Delphi:
MJ:{"Name":"This is a Str100","Age":100,"List":[1,"Hello",5,{"name":"c5soft","age":50}]}
mORMot JS: 265
SO:{"Age":100,"Name":"This is a Str100","List":[1,"Hello",5,{"age":50,"name":"c5soft"}]}
SuperObject: 1294
MJ:{"Name":"This is a Str100","Age":100,"List":[1,"Hello",5,{"name":"c5soft","age":50}]}
mORMot JS: 250
SO:{"Age":100,"Name":"This is a Str100","List":[1,"Hello",5,{"age":50,"name":"c5soft"}]}
SuperObject: 1295
Mantis conversion info:
- Mantis ID: 30860
- Version: 3.0.0
- Monitored by: » jixian.yang (yang jixian), » luizamerico (Luiz Americo)