
Boost : 
From: Lewis Hyatt (lhyatt_at_[hidden])
Date: 20070328 15:54:05
Hello
I don't think I will have time to write a full review of units (and I
probably don't know enough to seriously critique it anyway), but FWIW, I
think it should be accepted, and it looks quite useful and well designed
to me.
I did try some quick performance tests out of curiosity on a few
different systems. Here is the output of the unit_example_14 test
program for:
1) gcc 3.4.4 on WinXP / MinGW (Intel P4 2.8 GHz)

f(x,y,z) took 6.593 seconds to run 1e+009 iterations with double =
6.06704e+008 flops
f(x,y,z) took 10.782 seconds to run 1e+009 iterations with
quantity<double> = 3.70989e+008 flops
g(x,y,z) took 6.625 seconds to run 1e+009 iterations with double =
6.03774e+008 flops
g(x,y,z) took 9.906 seconds to run 1e+009 iterations with
quantity<double> = 4.03796e+008 flops

2) gcc 3.4.4 on WinXP / cygwin (Intel P4 2.8 GHz)

f(x,y,z) took 6.5 seconds to run 1e+09 iterations with double =
6.15385e+08 flops
f(x,y,z) took 10.375 seconds to run 1e+09 iterations with
quantity<double> = 3.85542e+08 flops
g(x,y,z) took 6.719 seconds to run 1e+09 iterations with double =
5.95327e+08 flops
g(x,y,z) took 10.531 seconds to run 1e+09 iterations with
quantity<double> = 3.79831e+08 flops

3) gcc 3.4.6 on Linux (Intel Xeon 3.2 GHz)

f(x,y,z) took 13.76 seconds to run 1e+09 iterations with double =
2.90698e+08 flops
f(x,y,z) took 17.34 seconds to run 1e+09 iterations with
quantity<double> = 2.30681e+08 flops
g(x,y,z) took 13.82 seconds to run 1e+09 iterations with double =
2.89436e+08 flops
g(x,y,z) took 14.76 seconds to run 1e+09 iterations with
quantity<double> = 2.71003e+08 flops

4) gcc 3.4.6 on Linux (AMD Athlon 1.6GHz)

f(x,y,z) took 27.83 seconds to run 1e+09 iterations with double =
1.4373e+08 flops
f(x,y,z) took 33.22 seconds to run 1e+09 iterations with
quantity<double> = 1.20409e+08 flops
g(x,y,z) took 27.54 seconds to run 1e+09 iterations with double =
1.45243e+08 flops
g(x,y,z) took 30.68 seconds to run 1e+09 iterations with
quantity<double> = 1.30378e+08 flops

So gcc, at least, seems to be able to tell the difference when the units
are being used, at the level of a few tens of percent. This was compiled
with
g++ s O3 DNDEBUG
I also tried compiling with gcc 3.3.3 but got a large number of
errors... I attached the gzipped output in case that is interesting, but
maybe this compiler is not supposed to be supported anyway?
Lewis
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk