This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [offtopic] float vs. double?
- To: jbuck at synopsys dot com, jstern at citilink dot com
- Subject: Re: [offtopic] float vs. double?
- From: Josh Stern <jstern at citilink dot com>
- Date: Tue, 4 Aug 1998 22:51:14 -0500 (CDT)
- Cc: egcs at cygnus dot com, nbecker at fred dot net, nyap at garban dot com
- Posted-Date: Tue, 4 Aug 1998 22:51:14 -0500 (CDT)
>> 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