
Ok, I probably won't get to do this until Friday again...that's the day I get to work on personal things at work for a few hours...I don't have VC.
I don't have access to it at all, so I appreciate any help in getting things to function correctly under VC++...
I was profiling my own version and it was dog slow compared to doubles. I wanted to check yours. I did here at home with g++ on Linux and our two versions compare equally wrt the static dim quantity. I had to really vamp up the optimizations of course to get them as fast as doubles (I couldn't find the right options for VC) and I still can't do
I haven't spent much time (following the Boost admonition to focus on clarity and correctness before optimization) tuning performance yet. I don't believe that there is anything in the quantity class that can't, in principle, be optimized away. That being said, principle and practice can be separated by a significant gulf at times...good compiler inlining will be critical to optimization. Any input on optimizing the library would be most welcome - I expect that it should be possible to have code using quantities run exactly as fast as for built in types, but that remains to be proven...
as deep a recursion level without a seg fault...this is actually by quite a margin...several orders of magnitude. Both versions fail at the same point. Here is test code...add a 0 to the end of tlim and I get a crash on the quantity version:
I'm personally more concerned about runtime performance than recursion at this point, but this is an interesting point... I'm not completely clear on what you mean about increasing tlim : do you mean that the equivalent code with doubles can recurse several orders of magnitude deeper, and mcs::units recurses one order of magnitude deeper than your quantity code?
COMMAND LINE:
nroberts@localhost ~/projects/prof_units $ g++ -I/home/nroberts/units -pg -O3 prof_mcs.cpp
This is likely implementation dependant and maybe there's still more ops.
It looks like I'm having a dumb day today. Do you mean that there are more operations in the quantity code than there are for doubles??? Anyway, thanks for the feedback... Matthias