Subject: Re: [proto] Transform result_of nightmare and preserving terminal identity
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2012-10-31 16:28:47
On 31/10/2012 04:59 p.m., Eric Niebler wrote:
>> Proto expressions build and optimization times are not taken into
>> >account. There is a considerable number of expression copies made by the
>> >expression optimization that cannot be avoided by the compiler.
> Expression copies ... during expression evaluation? I wonder why that's
Not during expression evaluation, but during expression optimization. My
optimization transform unrolls vector expressions into their
component-wise expression equivalents; that generates a number of
expressions that have to be held by value and hence copied.
>> >I will
>> >continue my research by implementing a custom evaluation context that
>> >does this optimization 'on the fly', without actually modifying the
> Evaluation contexts are weaker than transforms. If it can't be done with
> a transform, it can't be done with a context. I can't tell from the code
> fragment what exactly you're doing with the transforms you've written,
> or whether they can be improved.
Quoting from my original mail, what I want is to replace the following
geometric vector expression:
p = q + r;
p = q + r,
p = q + r,
p[N] = q[N] + r[N],
It **can** be done with a transform and that's what I did. The optimized
proto expression evaluates ~33% faster than the original proto expression.
I believe it can also be done with an evaluation context, that evaluates
an expression N times with a component-wise evaluation context. A
component-wise evaluation context would be a default context evaluation
except that vector terminals are evaluated to one of its scalar components.
Now that my transform finally works as intended, I will clean up the
code and upload it somewhere for you and anyone interested to see it.
Agustín K-ballo Bergé.-
Proto list run by eric at boostpro.com