Jump to content

RDAF

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. RDAF

    Extremely slow

    Ohh, by the way. Thank you all for some nice posts in this forum, I already got some really nice hints here.
  2. RDAF

    Extremely slow

    Hi I'm using some simple calculations from Python (from open-dis-python). If I just run the calculations in Python, E.G. 1000 times, it takes miliseconds. If I run it from Delphi, it takes 3-4 seconds for the same amount of calculations. Without being an expert at all, my guess is, that each time I call PythonEngine1.ExecStrings( Memo1.Lines ); it creates the entire python structure and free it again, or the mechanism that transfers variables between Python and Delphi is extremely slow (PythonDelphiVarxx). The attaches .py file is the one I use. I send lla from delphi and needs ecef return. Which works fine, but slow. This is how I call the function 1000 times to measure performance: procedure TForm1.Button5Click(Sender: TObject); var I: Integer; TEST : double; Tekst: String; Tid2,Tid3,freq: Int64; begin memo2.Clear; QueryPerformanceFrequency(Freq); QueryPerformanceCounter(Tid2); //memo2.Lines.Add(inttostr(tid)); for I := 0 to 999 do begin PythonEngine1.ExecStrings( Memo1.Lines ); //Application.ProcessMessages; if I mod 100 = 0 then begin Application.ProcessMessages; //sleep(50); Tekst := edit1.Text; Tekst := StringReplace(Tekst,'.',',',[rfReplaceAll]); Test := strtofloat(Tekst); Test := test + 0.001; Tekst := floattostr(Test); Tekst := StringReplace(Tekst,',','.',[rfReplaceAll]); edit1.Text := Tekst; end; end; QueryPerformanceCounter(Tid3); memo2.Lines.Add('Time: ' +floattostr(((Tid3-Tid2)*1000)/Freq)); I get the result via PythonDelphiVar_OnChange Any hints on performance RangeCoordinates.py
×