Boost logo

Boost :

Subject: Re: [boost] [Multiprecision] Benchmarking
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-06-15 02:26:12

Le 15/06/12 08:07, Dave Abrahams a écrit :
> on Thu Jun 14 2012, John Maddock<> 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.

I agree, the library should be able to decide whether expression
templates should be an improvement or not.

A minor change in the library, defaulting the ExpressionTemplates
parameter to a trait depending on the backend could help to that.
The library could default to something reasonable, while the backend
developer could always provide a specialization.


Boost list run by bdawes at, gregod at, cpdaniel at, john at