Jump to content

lg17

Members
  • Content Count

    3
  • Joined

  • Last visited

Everything posted by lg17

  1. Hi all. I observe a noticable difference of execution time for the same code, compiled in 32 bits and 64 bits. The following code is an extract of a more complex application. If you run it, it will always take much more time in 64 bits than in 32 bits. The code can be tested using arrays of 1, 2 or 3 floats (option 1,2 and 3). If I look at the assembly code in debug mode, it is different in 32b and 64b. Any idea how to make the 64 bits version run as fast as the 32 bits one? (Compilation options or code adjustments?) Thanks. Note: I'm using Delphi 12.1 Here is the code: Type {$IF Defined(WIN64)} t_reel = double; {$ELSE} t_reel = single; {$ENDIF} t_vect1 = Array[0..0] OF t_reel; t_vect2 = Array[0..1] OF t_reel; t_vect3 = Array[0..2] OF t_reel; const k_vect1_nul : t_vect1 = (0.0); k_vect2_nul : t_vect2 = (0.0, 0.0); k_vect3_nul : t_vect3 = (0.0, 0.0, 0.0); procedure test(); var iLoop:integer; l_SW1:TStopwatch; l_vec1: t_vect1; l_vec2: t_vect2; l_vec3: t_vect3; begin l_SW1:=TSTopWatch.StartNew; iLoop:=0; while (iLoop<900000000) do begin //l_vec1 := k_vect1_nul; //option 1 //l_vec2 := k_vect2_nul; //option 2 l_vec3 := k_vect3_nul; //option 3 inc(iLoop); end; l_SW1.Stop; Showmessage(intToStr(l_SW1.ElapsedTicks)+' ticks / '+intToStr(l_SW1.ElapsedMilliseconds)+' ms'); end;
  2. Thanks @DelphiUdIT The most efficient solutions we found was l_vec3[0] := k_vect3_nul[0]; l_vec3[1] := k_vect3_nul[1]; l_vec3[2] := k_vect3_nul[2];
  3. Thanks to all for your answers. In my mind, 32 bits application should perform better with 32b float and 64 bits application with 64b float. This is why I have this compilation condition at the beginning. I'm going to try using the move instruction where it is possible and see if it improves the speed. The problem is that this slowness issue happens also when I assign a vectX to another vectX... like l_vec3A := l_vec3B; so everywhere in the code. I don't know if this is something that could be solved/improved by embarcadero. Thanks.
×