[cfe-dev] Smart pointer usage in the Parser/Actions

Douglas Gregor dgregor at apple.com
Fri Dec 19 08:54:09 PST 2008


On Dec 19, 2008, at 5:47 PM, Sebastian Redl wrote:

> steve naroff wrote:
>> Folks,
>>
>> Over the past week or so, there's been some discussion about making
>> extensive use of smart pointers in the parser (on clang-dev).
>>
>> Since the change is pervasive (and influences the programming model),
>> we discussed the topic yesterday (with Apple compiler engineers
>> working on clang).
>>
>> We concluded it makes sense to follow-through with the changes.
> Great! :-)
>> Our
>> only concern is performance: we don't want to degrade performance of
>> parsing correct code. For example, parsing system headers remains a
>> bottleneck. Since system headers don't contain invalid code, it's
>> important this improvement not degrade performance. Once the change  
>> is
>> complete, it's important we do "A/B comparisons" to measure the
>> performance for parsing valid code.
>>
> The tricky part about A/B comparisons is that the changes are
> interleaved with other changes, which mask the performance cost of  
> this
> particular change. In many projects, this would be handled by  
> branching
> for the interface change, with updates from trunk being regularly  
> merged
> to the branch, and then comparing performance of trunk and branch.  
> With
> clang's development model, this is not possible; A/B comparisons would
> have to be performed by carefully creating a version with the relevant
> changes removed. However, since the basic groundwork is already in
> trunk, its facilities are being used in other commits, too - see  
> Doug's
> recent template support commit. This changes the separation from a
> difficult task into an impossible one.


We think we can drop in some #ifdefs that make the smart pointers just  
act like raw pointers (eliminating the destructor, removing the  
pointer to the Action class, etc.) to get a feel for the performance  
differences.

	- Doug



More information about the cfe-dev mailing list