On 31/10/2012 05:28 p.m., Agustín K-ballo Bergé wrote:
On 31/10/2012 04:59 p.m., Eric Niebler wrote:
>I will
>continue my research by implementing a custom evaluation context that
>does this optimization 'on the fly', without actually modifying the
>expression.
 >
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;

by

     p[0] = q[0] + r[0],
     p[1] = q[1] + r[1],
     ...,
     p[N] = q[N] + r[N],
     p;

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.

I have uploaded my experiment to https://github.com/eggs-cpp/eggs-la . It only implements what is needed for my research, there are wholes pretty much everywhere.

Agustín K-ballo Bergé.-
http://fusionfenix.com

_______________________________________________
proto mailing list
proto@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/proto

Reply via email to