| In general, the C and C++ language standards leave the size of "int" as "implementation defined." This means that the processor vendor defines the size of int as the standard word size on the machine, and therefore the fastest word type to use.
Decades ago, floating-point operations migrated from software onto hardware, first in dedicated floating point unit chips and then onto the central processing unit chip itself.
Just as there is an implementation-defined "natural" word size for the CPU, so there is an implementation-defined "natural" floating-point number size for the FPU. This will perform without typecasting or unnecessary memory fetches or pipeline out of orders, and therefore run fastest.
Currently, as far as I know, the Intel native floating point register size is 80 bits which is closer to double than to float.
So other things being equal, double should be faster than float.
But the size of a data type is not the only factor impacting performance. Moving arrays of data around in the system, and moving code into and out of cache, also affect performance. Tests with Csound built with MinGW on Windows, in fact, show that the float version runs about 15% faster.
I would expect this not at all to be the case if Csound was built for 64 bit code, not just 64 bit samples, but I haven't done that.
I think these tests actually have to be performed on a specific processor and operating system to determine whether float or double samples actually run faster.
This reminds me to repeat that test...
Regards,
Mike
-----Original Message-----
>From: Julian Peterson
>Sent: May 19, 2008 2:44 PM
>To: csound@lists.bath.ac.uk
>Subject: [Csnd] Re: 64 bit / double question
>
>Well, I experimented with both a useDouble=0 version and a useDouble=1
>version. The same csd provided these two results rendering to a file:
>
>with useDouble=0 (ie, 32 bit):
> CPU : 167 seconds
>with useDouble=1 (64 bit):
> CPU : 59 seconds
>
>I suppose this makes sense, but it was contrary to my expectations.
>It's nearly 3 times as fast to use 64bit internal samples under these
>circumstances. These experiments were done with a macbook core 2 duo
>(64bit) processor, osx 10.5 (64bit) and csound with Word64=1.
>
>Thanks,
>JP
>
>
>On May 19, 2008, at 9:57 AM, Julian Peterson wrote:
>
>> Hi list.
>>
>> If you have a 64bit processor, 64bit OS, and a copy of csound built
>> with Word64=1, is there any speed advantage to useDouble=0 vs
>> useDouble=1?
>>
>> Thanks,
>> JP
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> "unsubscribe csound"
>
>
>
>Send bugs reports to this list.
>To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|