From: Gunter Winkler (guwi17_at_[hidden])
Date: 2007-11-05 14:08:20
Am Montag, 5. November 2007 17:25 schrieb Dag Lindbo:
> Ok, thanks. As far as I know both RVO and NRVO are allowed by the
> standard, but neither is required. In a land of Fortran die-hards the
> design decision to use return-by-value instead of passing the rvalue
> by reference has to be supported by some indication that the compiler
> actually did actually do the (N)RVO. Am I right that g++ does not
> support generating a summary of which optimizations that were
> actually performed?
I think the simplest way to find out how good g++ performs is to
generate an optimized assembly output instead of the usual binary. The
second way is to use a large enough data vector such that the copy
operation takes a measurable amount of time.
> Does uBLAS vector constructors have a higher verbosity level which
> would allow me to in see how many constructors were executed?
No, but you can simply add the necessary lines to vector.hpp in order to
see what constructor is called.
One more note: You can use expression templates to defer the calculation
until the final assignment. I could provide a apply_to_all_elements<OP>
expression that applies the unary functor OP to all elements of a given
vector. I only have to assure that the functor is able to carry
references to arguments.