Re: Attribute propagation vs. Semantic actions

Joel de Guzman <[email protected]> Tue, 16 Mar 2010 23:33:14 +0800
Newsgroups gmane.comp.parsers.spirit.devel
Message-ID <[email protected]>
On 3/16/2010 9:11 PM, Joel de Guzman wrote:
> Hi Y'all,
>
> CC'ing Hartmut and John Wilkinson.
>
> I've been looking into attribute propagation vs. semantic actions
> lately. It has come to my attention that attribute propagation is
> not as efficient as we thought it would be (perhaps due to some recent
> changes and strategies we have incorporated). Here's a test case
> that does the same thing with attribute propagation and with semantic
> actions. Just define ATTR_PROPAGATE to choose the former, or undefine
> for the latter. Here's the printout with attribute propagation:

[snip]
>
> Obviously, the one with semantic actions win. Notice though that
> on both cases, there's way too much copying. I suspect unwanted
> copying of the vector. Man, this is unacceptable. We have to fix this!

More info...

The excessive copying  involves resizing of the vector(attribute).
Adding a result.reserve(20); at the start gives me:

Case with semantic actions:

     construct from char
     copy construct
     construct from char
     copy construct
     construct from char
     copy construct
     construct from char
     copy construct
     construct from char
     copy construct

The case with attributes just a tad bit more efficient
than before :-(:

     default construct
     construct from char
     assign
     copy construct
     copy construct
     default construct
     construct from char
     assign
     copy construct
     copy construct
     default construct
     assign
     construct from char
     assign
     copy construct
     copy construct
     default construct
     assign
     construct from char
     assign
     copy construct
     copy construct
     default construct
     assign
     construct from char
     assign
     copy construct
     copy construct
     default construct
     assign

Regards,
-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net
http://www.facebook.com/djowel

Meet me at BoostCon
http://www.boostcon.com/home
http://www.facebook.com/boostcon




------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev