
on Thu Jun 14 2012, John Maddock <boost.regex-AT-virgin.net> wrote:
- Expression templates make the code slower.
For sure - expression templates are about eliminating temporaries - if the temporaries are cheap (cpp_int containing small values and no dynamic memory allocation) then there's no benefit and probably a hit from bringing in all that machinary. That's why expression templates are disabled for the fixed size cpp_int typedefs.
I'd like to propose an alternate viewpoint: in the context of numerics, expression templates are about delaying evaluation to gather more context, so you can perform the computation more efficiently. From that point-of-view there's absolutely no reason that they should ever make code slower. Just generate the appropriate code for the types and expressions involved. -- Dave Abrahams BoostPro Computing http://www.boostpro.com