
Matthias Schabel wrote:
Just for reference, using gcc 4.0.1 on Mac OSX (G5 2GHz) I get no overhead :
I just tried gcc 4.0.2 on AMD Opteron 2.2 GHz, and I get no overhead as well: f(x,y,z) took 3.21 seconds to run 1e+09 iterations with double = 1.24611e+09 flops f(x,y,z) took 3.18 seconds to run 1e+09 iterations with quantity<double> = 1.25786e+09 flops g(x,y,z) took 3.2 seconds to run 1e+09 iterations with double = 1.25e+09 flops g(x,y,z) took 3.19 seconds to run 1e+09 iterations with quantity<double> = 1.25392e+09 flops I guess gcc 3.4.4 just doesn't cut it these days! Steven Watanabe wrote:
unit_example_14.cpp passes double by value and quantity by reference. When I looked at the assembler output from msvc 8.0 it looked like this had a noticable effect (the quantity code was quite a bit more complex).
I just tried it, and changing the pass by value to pass by reference did not affect the timings on gcc 3.4.4. (I did not confirm but I believe gcc is inlining the function call anyway.) -Lewis