[cfe-dev] Parsing benchmark: LibTomMath

Steve Naroff snaroff at apple.com
Sun Nov 18 09:25:06 PST 2007


On Nov 17, 2007, at 6:47 PM, Neil Booth wrote:

> Steve Naroff wrote:-
>
>> I'd like to emphasize something (my own form of over analysis:-)...
>>
>> Unlike gcc, clang is being developed as a set of reusable components
>> (with the goal of supporting a diverse set of needs). From my
>> perspective, striking the right balance between abstraction and
>> performance is an "art". It's hard to do, and hasn't been a part of
>> the C compiler development culture over the years (making it  
>> difficult
>> to find people that respect/understand this idiom).
>
> I think you're absolutely right; the library / interface idiom is
> the right approach and will have huge payoff in many directions.  I
> prefer the architecture of clang to my own front end for this reason,
> and am attempting to reorganize it in a similar direction.
>

Interesting (and good to hear).

> I agree with Chris and doubt the abstraction costs much either; I'd
> be surprised if it exceeded 10% or so.  I think NetBSD is a good  
> example
> (in C) of how abstracted code can be cleaner and just as efficient.
>

I also agree with Chris - I certainly wasn't trying to say the  
abstraction penalty is our problem.

My only point was it's always going to be hard to do an "apple to  
apple" comparison. I brought up "Tiny C" as a way to dramatize my point.

I think Chris said it best when he characterized the data as a "good  
indicator" (of performance).

> I have no idea why clang is slower than cfe; the gap surprised me too.
> I'm not doing anything magic; it's just straight-forward C code like
> APFloat would look like if you removed the class syntactic sugar.  I
> build a fairly complete internal representation; there's no corner
> being cut.
>

For "header rich" projects (like those @ Apple), we spend most of our  
time preprocessing and malloc'ing (building the AST's).

The breakdown is roughly, 60/30/10 (preprocessor, AST building/ 
semantic analysis, parsing).

I am not familiar with LibTomMath - I would guess it isn't header rich.

If your cfe has a "-E" switch, it might be interesting to see how it  
compares with clang. If there isn't a big difference in preprocessor  
performance, we know it is likely to be in the AST building and  
semantic analysis.

Curious,

snaroff

> Neil.




More information about the cfe-dev mailing list