On Monday 19 May 2008 15:03:15 Michael Gogins wrote: > 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. This is not entirely true AFAICS. While the FPU uses the 80 bit floating point size, the memory bus is still 32 or 64 bit wide (depending on the architecture), so memory fetches would still be slower with doubles on a 32bit OS (such as your typical version of Windows, since it won't use the extra 32 bits of the memory bus). This, as you note, would be different in a 64bit OS. I also presume that the opcodes used might have an impact too. > > 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... I'll run a test here and see if it makes a difference. I have a Core 2 Duo with Linux 64 bit installed. I'll be using trapped.csd to benchmark. -- Felipe Sateler