Re: [eigen] Nesting by reference of by value ?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]




On Wed, Nov 18, 2009 at 6:45 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
2009/11/18 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
>
> Hi,
>
> I've just played a bit with Hauke's nesting refactoring fork
> (https://bitbucket.org/hauke/nesting-refactoring/).
>
> Let me recall that currently expressions are nested by reference that
> enforces the use NestByValue when a function has to return a nested
> _expression_. See for instance adjoint() which returns
> Transpose<NestByValue<CwiseUnaryOp<ei_scalar_conjugate<Scalar>, Derived> >
>>. As you can see this is pretty annoying. In Hauke's fork lightweight
> expressions (i.e., all but Matrix) are automatically nested by value. So
> need for the NestByValue workaround.
>
> So now the question is what about the performances ? Well I tried a very
> simple example:
>
> Vector4f a, b, c, d;
> c = a+b+c+d;
>
> and here are the respective assembly codes generated by g++ 4.3.3

That wouldn't be the first time that g++ 4.3 is stupid, right?

It would be interesting to see g++ 4.4.

Benoit



ok, gcc 4.2 has same issue here.

gcc 4..4 generates the same good code in both case:


    movaps    112(%rsp), %xmm0
    addps    96(%rsp), %xmm0
    addps    80(%rsp), %xmm0
    addps    64(%rsp), %xmm0
    movaps    %xmm0, 80(%rsp)

gael.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/