This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [offtopic] float vs. double?


>> For very large vectors and matrices of numbers, the speed 
>> differences due to memory usage and the amount of data that 
>> needs to be copied around is likely to be much greater than 
>> the differences between the speed of the computations 
>> themselves, so float could sometimes give a real advantage.

>Figure out how many muliplies you can do in one cache miss time (the 
>answer often exceeds 20).  As soon as you don't fit in cache, float is 
>twice as fast as double, because the critical path is the I/O.

Yes, I was thinking about these things.  In general, it is
best to experiment with a specific situation - e.g. 20 / (8k / 4)
is not a big percentage, but the problem is much worse with,
for example, an image processing or matrix algorithm that is 
traversing data by 'spatial' rather than memory adjacency, so it 
can really be cache thrashing.  So a rule of thumb needs to
be somewhat algorithm dependent.  


- Josh






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]