Boost logo

Boost :

Subject: Re: [boost] [Multiprecision] Benchmarking
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-06-15 02:07:05


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

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk