On 30/09/13 20:19, Eric Niebler wrote:

Yikes! You don't need me to tell you that's UB, and you really shouldn't
encourage people to do that.

Yet it's apparently the only way to get the same performance as the real thing.


You can independently control how intermediate nodes are captured, as
opposed to how terminals are captured. In this case, you want a,b,c held
by reference, and the temporary "a*b" to be held by value. Have you
tried this, and still found it to be slow?

Yes, that's what I said in my original post. What wasn't clear about it?

I said that holding nodes by value except terminals by reference was the old strategy I had been recommending, and that it actually prevented optimizations.

To clarify, in terms of performance, from best-to-worst:
1) everything by reference: no problem with performance (but problematic dangling references in some scenarios)
2) everything by value: no CSE or other optimizations
3) nodes by value, terminals by reference: no CSE or other optimizations + loads when accessing the terminals

I'll be doing more experiments on the subject.
_______________________________________________
proto mailing list
proto@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/proto

Reply via email to