Subject: Re: [proto] The proper way to compose function returning expressions
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-04-26 12:35:36


On 26/04/12 18:02, Eric Niebler wrote:

> Interesting. I avoided this design because I was uncertain whether the
> compiler would be able to optimize out all the copies of the
> intermediate nodes. You're saying NT2 does it this way and doesn't
> suffer performance problems? And you've hand-checked the generated code
> and found it to be optimal? That would certainly change things.
>

NT2 treats large amounts of data per expression, so construction time is
not very important. It's the time to evaluate the tree in a given
position that matters (which only really depends on proto::value and
proto::child_c<N>, which are always inlined now).

We also have another domain that does register-level computation, where
construction overhead could be a problem. The last tests we did with
this was a while ago and was with the default Proto behaviour. That
particular domain didn't get sufficient testing to give real conclusions
about the Proto overhead.