[cfe-dev] Clang indexing library performance

Alexander Bolodurin alexander.bolodurin at gmail.com
Sun Oct 2 04:27:08 PDT 2011


On 02/10/2011, at 9:38 PM, Tobias Grosser wrote:

> On 10/02/2011 10:06 AM, Alexander Bolodurin wrote:
>> On 02/10/2011, at 10:34 AM, Tobias Grosser wrote:
>> 
>>> >  On 10/01/2011 10:34 AM, Alexander Bolodurin wrote:
>>> >  Can you send me your new results, either only with the parse() change, and then with both the parse() and the complete() change.
>>> >
>>> >  Thanks and cheers
>>> >  Tobi
>> parse only:
>> 
>> parse 3.55141305923
>> complete 2.60280609131
>> complete 2.53132414818
>> complete 2.54255604744
>> complete 2.50854682922
>> 
>> parse + complete:
>> 
>> parse 3.58968901634
>> complete 2.62985301018
>> complete 2.55927109718
>> complete 2.54651212692
>> complete 2.55211901665
> OK. This is not very convincing.
> 
>> I have also tried to eliminate the middlemen completely and use C interface directly using this tool:https://gist.github.com/758615  from this clang_complete bug report:https://github.com/Rip-Rip/clang_complete/issues/17  which you have already read, as I can see.
> 
> OK. Let's get a common baseline. Can you run the complete tool (from the bug report) on the attached boost.cc file (taken from the very same bug report, you need boost installed) and compare it with my results.
> 
> ------------------------------------------------------------
> > export LIBCLANG_TIMING=1
> > $./a.out boost.cc 16 10 > /dev/null
> Parsing boost.cc:   1.3400 (100.0%)   0.1000 (100.0%)
>                    1.4400 (100.0%)   1.4527 (100.0%)
> Precompiling preamble:   1.8800 (100.0%)   0.0900 (100.0%)
>                         1.9700 (100.0%)   1.9999 (100.0%)
> Reparsing boost.cc:   2.0800 (100.0%)   0.1200 (100.0%)
>                      2.2000 (100.0%)   2.2548 (100.0%)
> Code completion @ boost.cc:16:10:   0.1800 (100.0%)   0.1800 (100.0%)
> 				    0.1901 (100.0%)
> ------------------------------------------------------------
> 
> The autocompletion takes for me 0.20 seconds and is significantly shorter than the parsing. Do you get something similar?
> 
> Cheers
> Tobi
> <boost.cc>


I may have omitted one crucial detail: I run 2.9 release.
I've run your test case with 2.9 and svn build and I do indeed get timing comparable to yours.

-------------------8<-------------------
Parsing boost.cc:   1.3869 (100.0%)   0.2169 (100.0%)   1.6038 (100.0%)   1.6073 (100.0%)  
Precompiling preamble:   2.1251 (100.0%)   0.4021 (100.0%)   2.5273 (100.0%)   2.7308 (100.0%)  
Cache global code completions for boost.cc:   0.4364 (100.0%)   0.0050 (100.0%)   0.4413 (100.0%)   0.4414 (100.0%)  
Reparsing boost.cc:   2.6944 (100.0%)   0.5080 (100.0%)   3.2024 (100.0%)   3.4065 (100.0%)  
Code completion @ boost.cc:16:10:   0.1284 (100.0%)   0.0418 (100.0%)   0.1702 (100.0%)   0.1703 (100.0%)  
-------------------8<-------------------
Parsing boost.cc:   1.4944 (100.0%)   0.1213 (100.0%)   1.6157 (100.0%)   1.6160 (100.0%)  
Precompiling preamble:   2.0441 (100.0%)   0.2648 (100.0%)   2.3089 (100.0%)   2.3872 (100.0%)  
Cache global code completions for boost.cc:   0.5091 (100.0%)   0.0047 (100.0%)   0.5138 (100.0%)   0.5138 (100.0%)  
Reparsing boost.cc:   2.6945 (100.0%)   0.3137 (100.0%)   3.0082 (100.0%)   3.0866 (100.0%)  
Code completion @ boost.cc:16:10:   0.1372 (100.0%)   0.0275 (100.0%)   0.1647 (100.0%)   0.1651 (100.0%)
-------------------8<-------------------

However... for my original test case, I get almost 4x speedup!

-------------------8<-------------------
Parsing f.cc:   2.9795 (100.0%)   0.5403 (100.0%)   3.5199 (100.0%)   3.5210 (100.0%)  
Precompiling preamble:   4.6721 (100.0%)   1.0640 (100.0%)   5.7361 (100.0%)   6.4709 (100.0%)  
Cache global code completions for f.cc:   1.0227 (100.0%)   0.0065 (100.0%)   1.0292 (100.0%)   1.0324 (100.0%)  
Reparsing f.cc:   6.2431 (100.0%)   1.3625 (100.0%)   7.6056 (100.0%)   8.3611 (100.0%)  
Code completion @ f.cc:6:8:   2.0723 (100.0%)   0.4668 (100.0%)   2.5391 (100.0%)   2.5500 (100.0%)  
-------------------8<-------------------
Parsing f.cc:   3.2017 (100.0%)   0.2806 (100.0%)   3.4822 (100.0%)   3.4856 (100.0%)  
Precompiling preamble:   4.2331 (100.0%)   0.5612 (100.0%)   4.7942 (100.0%)   5.0883 (100.0%)  
Cache global code completions for f.cc:   1.2300 (100.0%)   0.0061 (100.0%)   1.2362 (100.0%)   1.2362 (100.0%)  
Reparsing f.cc:   6.0510 (100.0%)   0.7061 (100.0%)   6.7571 (100.0%)   7.0513 (100.0%)  
Code completion @ f.cc:6:8:   0.6013 (100.0%)   0.0895 (100.0%)   0.6908 (100.0%)   0.6909 (100.0%)
-------------------8<-------------------

So, I guess I'll just have to use the svn build until the next Clang release.
There is still overhead in clang_complete itself, but that's not clang's problem.

Thanks.



More information about the cfe-dev mailing list