Recent

Author Topic: slow windows more than android  (Read 1905 times)

escape

  • Newbie
  • Posts: 2
slow windows more than android
« on: November 18, 2021, 02:05:03 am »
lazarus ver : 2.3.0 (FPC 3.3.1) - win64
my OS : windows 10

i make dynamic (linking) library
uses cross compile
(android : '.so',   windows : '.dll')

one project made objects (.so and .dll)
however same code working time is slow '.dll' more then '.so'
(my PC 'H/W' have good perfomence)
(working code : parsing string and make thread, etc)

i guess missing the build option
but i can't solve

thank you for advice



loaded

  • Sr. Member
  • ****
  • Posts: 441
Re: slow windows more than android
« Reply #1 on: November 19, 2021, 11:24:26 am »
I think there is an unusual situation;
In my tests Window is 2x faster than Android.

Lazarus : 2.3.0 + Fpc 3.2.0
Android : LAMW + Aarch64 +  Android 8.1  + Xiomi Redmi 5 Plus
Windows : Win 10 Enterprise + i7 4770

Test Code Android ~ 12.508 Second :
Code: Pascal  [Select][+][-]
  1. function getString(PEnv: PJNIEnv; this: JObject; flag: JInt): JString; cdecl;
  2. var
  3.   i:integer;
  4.   dc:Double=0;
  5.   crono:Cardinal;
  6. begin
  7.   crono:=GetTickCount;
  8.   for i:=low(integer) to 5000 do
  9.   begin
  10.   dc:=dc+i;
  11.   end;
  12.   Result:= (PEnv^).NewStringUTF(PEnv,pchar(FloatToStr((GetTickCount-crono)/1000)));
  13. end;


Test Code Windows  ~5.625 Second;
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   i:integer;
  4.   dc:Double=0;
  5.   crono:Cardinal;
  6. begin
  7.   crono:=GetTickCount;
  8.   for i:=low(integer) to 5000 do
  9.   begin
  10.   dc:=dc+i;
  11.   end;
  12.   TButton(sender).Caption:= FloatToStr((GetTickCount-crono)/1000);
  13. end;    
If Ide=Lazarus 2.0.10 32 Bit and Os=Win 10 Home 64 Bit then Get up and do something useful! Because God is the helper of those who start again;

escape

  • Newbie
  • Posts: 2
Re: slow windows more than android
« Reply #2 on: November 23, 2021, 02:18:35 am »







I think there is an unusual situation;
In my tests Window is 2x faster than Android.

Lazarus : 2.3.0 + Fpc 3.2.0
Android : LAMW + Aarch64 +  Android 8.1  + Xiomi Redmi 5 Plus
Windows : Win 10 Enterprise + i7 4770

Test Code Android ~ 12.508 Second :
Code: Pascal  [Select][+][-]
  1. function getString(PEnv: PJNIEnv; this: JObject; flag: JInt): JString; cdecl;
  2. var
  3.   i:integer;
  4.   dc:Double=0;
  5.   crono:Cardinal;
  6. begin
  7.   crono:=GetTickCount;
  8.   for i:=low(integer) to 5000 do
  9.   begin
  10.   dc:=dc+i;
  11.   end;
  12.   Result:= (PEnv^).NewStringUTF(PEnv,pchar(FloatToStr((GetTickCount-crono)/1000)));
  13. end;


Test Code Windows  ~5.625 Second;
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   i:integer;
  4.   dc:Double=0;
  5.   crono:Cardinal;
  6. begin
  7.   crono:=GetTickCount;
  8.   for i:=low(integer) to 5000 do
  9.   begin
  10.   dc:=dc+i;
  11.   end;
  12.   TButton(sender).Caption:= FloatToStr((GetTickCount-crono)/1000);
  13. end;    

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
i agree to unusual situation

your test code worked in my devices
and i got similar result
my guess(build option) is wrong

but my original code is yet slow more PC
i was check slow code in 'TIdHTTPServer CommandGet event' and 'thread'

can you add advice?  please
thank you

loaded

  • Sr. Member
  • ****
  • Posts: 441
Re: slow windows more than android
« Reply #3 on: November 23, 2021, 07:38:30 am »
can you add advice?  please
My recommendation;
Have a minimum pascal code in shared Object files.
Use Java equivalents of your codes if possible.
Create the threads on the java side.
Your build option is aarch64.
I work very fast this way.

I also made a video on creating a so file in LAMW. https://www.youtube.com/watch?v=SCAOeAN3eU4
Maybe it will be useful for you. Regards.

If Ide=Lazarus 2.0.10 32 Bit and Os=Win 10 Home 64 Bit then Get up and do something useful! Because God is the helper of those who start again;

 

TinyPortal © 2005-2018