[DUG] Int64 or floating point faster?
Ross Levis
ross at stationplaylist.com
Sun Aug 17 14:54:23 NZST 2014
Thanks for that. I should have added I'm using Delphi 7 so a 32-bit
compiler. I assume with newer 64-bit compilers an integer is 64 bits by
default?
From: delphi-bounces at listserver.123.net.nz
[mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of Pieter De Wit
Sent: Sunday, 17 August 2014 11:04 a.m.
To: delphi at listserver.123.net.nz
Subject: Re: [DUG] Int64 or floating point faster?
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/e31d148c/attachment.html
More information about the Delphi
mailing list