Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Code Generation/Optimization    [ Add a report in this area ]  
Report #:  120016   Status: Closed
[Win64] Execution time is increase in 64-bit
Project:  Delphi Build #:  19.0.13476.4176
Version:    19.0 Submitted By:   piyush vaishnani
Report Type:  Feature Specification issue Date Reported:  10/25/2013 11:57:55 PM
Severity:    Commonly encountered problem Last Updated: 4/15/2014 6:37:41 PM
Platform:    All versions Internal Tracking #:   44696
Resolution: Fixed (Resolution Comments) Resolved in Build: : XE6
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 15
Description
Please check folloing code in 32 bit and 64 bit.

In 64  bit execution is increase.
-------------
procedure TForm1.Button1Click(Sender: TObject);
var
   cnt: Integer;
   d: Cardinal;
begin
   d := GetTickCount();
   for cnt := 0 to 1000000 do begin
      test();
   end;
   ShowMessage(inttostr(GetTickCount - d));
end;

function TForm1.test: Single;
var
   tmpVal: Single;
begin
   try
      tmpVal := 124;
      if (tmpVal > 0) then exit;
      tmpVal := -124;
   finally
      Result := tmpVal;
   end;
end;
-------------
Steps to Reproduce:
check in win 32 bit and win 64 bit.
Workarounds
None
Attachment
None
Comments

Chris Rolliston at 10/26/2013 9:54:09 AM -
Have you tried using {$EXCESSPRECISION OFF}? See here: http://www.delphitools.info/2011/09/05/xe2-single-precision-floating-point-disappointment/

piyush vaishnani at 10/27/2013 10:53:27 PM -
I try both  {$EXCESSPRECISION OFF} and  {$EXCESSPRECISION ON}. In both condition execution time is to much increase in win64 bit

Tomohiro Takahashi at 10/27/2013 11:26:31 PM -
>    ShowMessage(inttostr(GetTickCount - d));
Could you provide results(Win32 and Win64) to verify your case with my environment?

piyush vaishnani at 10/28/2013 2:07:18 AM -
In Win32 := 16

And

In Win64 := 656

Tomohiro Takahashi at 10/28/2013 8:22:36 PM -
I think this issue is caused by try/finally.

piyush vaishnani at 10/28/2013 9:21:40 PM -
so it's bug in win64 ?

piyush vaishnani at 10/27/2013 10:47:03 PM -
yes I try with {$EXCESSPRECISION OFF}.

Chris Havelick at 11/22/2013 12:37:59 PM -
It has nothing to do with floating point.  If you used the debugger and disassemble you see that the 32 bit simply jumps to the finally when Exit is executed.  In 64 bit it calls _TryFinallyExit which then calls an windows api that unwinds the stack.  Pretty sure that is totally unecessary.

It is a really bad thing to use Exit inside of Try with Delphi 64 bit.  I am having to review many subroutines where I used the Exit statement thinking that it was ok to use.

Server Response from: ETNACODE01