|
From: Dan P. <ba...@al...> - 2004-03-15 22:12:16
|
On Mar 15, Jim Ursetto wrote:
> Fascinating. I guess Microsoft's compiler optimizes the entire vector
> like a built-in type (since it's made of built-in types with a default
> constructor and destructor).
Well, in general GCC tends to be known as a compromise of a compiler. It's
free, consistent, and works on a billion platforms, but the optimizations
aren't always the best. I guess this is a good example of that...
FWIW, I still think GCC produces pretty good code given those compromises,
and except in the most inner loops it probably won't make a bit of
difference. This just shows that it's worth your time to play around with
inner loops a bit.
> By the way, the tsunami vector has a default constructor which
> initializes all floats to 0 using default arguments. For my tests, I
> added a default empty constructor, "Vector() {}" to my copy, because gcc
> doesn't optimize the zeroing out either (even though it's overwritten in
> the next statement, a = b, with the default element-wise operator= ).
Doh, yeah, that is probably a good idea...
|