[fpc-pascal] Register variables slowing down floating point operations
Marcos Douglas
md at delfire.net
Fri May 13 13:52:58 CEST 2011
On Thu, May 12, 2011 at 3:54 PM, cobines <cobines at gmail.com> wrote:
> Hello.
>
> I have written the following program:
>
> program a;
> {$mode objfpc}
> uses
> SysUtils;
> var
> i: integer;
> vd: double;
> t: TDateTime;
> max: int64;// = 100000000;
> begin
> t := Now;
> max := 100000000;
> for i := 0 to max do
> vd := i / max;
> Writeln('Time: ', DateTimeToTimeStamp(Now - t).Time, ' ms');
> end.
>
> I'm running it on Windows XP i386, compiled with FPC 2.5.1 17430.
>
> # fpc -O a.pas
> ...
> # a.exe
> Time: 1462 ms
>
> # fpc -O3 a.pas
> ...
> # a.exe
> Time: 3325 ms
>
> It is slower with optimizations.
I did this test.
My env is FPC 2.4.3 (/fixes_2_4)
Result:
-O = run in 891 ms
-O1 = run in 875 ms
-O2 = run in 1656 ms
-O3 = run in 1625 ms
And now?
Marcos Douglas
More information about the fpc-pascal
mailing list