Boost logo

Proto :

Subject: Re: [proto] Holding children by copy or reference
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2013-09-30 18:59:21

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

> 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

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 list run by eric at