[DUG] Int64 or floating point faster?

Pieter De Wit pieter at insync.za.net
Sun Aug 17 11:04:24 NZST 2014


On 16/08/2014 15:30, Ross Levis wrote:
>
> Would I be correct that int64 multiplications would be faster than 
> floating point in Delphi?  My app needs to do several million.
>
>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at listserver.123.net.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at listserver.123.net.nz with Subject: unsubscribe
Hi,

Back in the good old days, a float was "int32.int32" - I am not sure 
what they have done with it since 64bit CPU's came about, but the theory 
should stay the same:

int64=64bit=1 clock cycle to move.
The "mul" command is normally 2 or 3 cycles, so worst case, your 
int64*int64 will be 6 cycle at worst (2 mov's, 3 for mul and 1 mov for 
the answer - moving it to your variable)

By comparison, using float *via the x64* will result in at least 18 
cycles - too early on a Sunday to work it out 100% :)

The tricky part, is the floating point CPU in your machine faster than 
the x64 - or more optimized for doing this? I don't know but I am 
willing to bet that it is not - floating point math has always been 
slower for me.

HTH,

Pieter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20140817/5e3d0a94/attachment.html 


More information about the Delphi mailing list