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;