[cfe-dev] Precompiled headers with libclang
Abhanshu Sharma
abhanshu1 at gmail.com
Wed Apr 4 02:52:15 PDT 2012
Doug/Chandler,
I am seeing a following improvments. Without precompiled preamble, I get
latencies of 2s to 3s. But when it is enabled, I get latencies around ~1s.
Is this the best possible optimization available with libclang?
When I reparse translation unit without 'precompile preamble' enabled, I am
seeing following latencies. I reparsed same source.cc five times:
#1. Reparsing source.cc: 0.7100 (100.0%) 0.0700 (100.0%) 0.7800
(100.0%) 2.6748 (100.0%)
#2. Reparsing source.cc: 0.8000 (100.0%) 0.0300 (100.0%) 0.8300
(100.0%) 3.2166 (100.0%)
#3. Reparsing source.cc: 0.7900 (100.0%) 0.0300 (100.0%) 0.8200
(100.0%) 2.4005 (100.0%)
#4. Reparsing source.cc: 0.7300 (100.0%) 0.0200 (100.0%) 0.7500
(100.0%) 2.1998 (100.0%)
#5. Reparsing source.cc: 0.7400 (100.0%) 0.0100 (100.0%) 0.7500
(100.0%) 2.2896 (100.0%)
But when I enable precompile preamble, I do see some improvement in
general. (from around ~2s earlier to ~1s now)
#1.
Precompiling preamble: 0.9200 (100.0%) 0.0200 (100.0%) 0.9400
(100.0%) 1.6569 (100.0%)
Cache global code completions for
/tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:
0.0600 (100.0%) 0.0600 (100.0%) 0.1440 (100.0%)
Reparsing
/tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:
1.0900 (100.0%) 0.0200 (100.0%) 1.1100 (100.0%) 2.5874 (100.0%)
#2. Reparsing
/tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:
0.1300 (100.0%) 0.0200 (100.0%) 0.1500 (100.0%) 3.5431 (100.0%)
#3. Reparsing
/tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:
0.1200 (100.0%) 0.0200 (100.0%) 0.1400 (100.0%) 1.0338 (100.0%)
#4. Reparsing
/tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:
0.1400 (100.0%) 0.1400 (100.0%) 1.0945 (100.0%)
#5. Reparsing
/tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:
0.1000 (100.0%) 0.0300 (100.0%) 0.1300 (100.0%) 0.9824 (100.0%)
#6. Reparsing
/tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:
0.1300 (100.0%) 0.0100 (100.0%) 0.1400 (100.0%) 1.1601 (100.0%)
[Note: There is no precompiling happening if no headers are changed as
expected.]
And when I modified one of its header file, I see precompiling preamble
again :
#7. Precompiling preamble: 0.9000 (100.0%) 0.0500 (100.0%) 0.9500
(100.0%) 2.1090 (100.0%)
Reparsing
/tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:
1.0300 (100.0%) 0.0700 (100.0%) 1.1000 (100.0%) 3.5036 (100.0%)
On Wed, Apr 4, 2012 at 2:41 PM, Abhanshu Sharma <abhanshu1 at gmail.com> wrote:
>
>
> On Wed, Apr 4, 2012 at 2:38 PM, Chandler Carruth <chandlerc at google.com>wrote:
>
>> On Wed, Apr 4, 2012 at 11:01 AM, Abhanshu Sharma <abhanshu1 at gmail.com>wrote:
>>
>>> I am trying to reduce every fraction of second possible. Since there are
>>> very large of header files, I guess there would be some time getting wasted
>>> in stat-ing those files. I want clang to assume everything else is constant
>>> except source file.
>>
>>
>> Stating is *extremely* fast, and does not have any bearing on the size of
>> the header file.
>>
>> Let me emphasize: *extremely* fast. 'git status' stats every single file
>> in the entire git tree in a tiny fraction of a second.
>>
>> Do you have a benchmark that clearly shows how much time is spent on
>> 'stat' here? Are you using a network filesystem that makes stat system
>> calls slow for some reason?
>>
> Yes I am using FUSE filesystems. I am not sure how slow stats are in my
> case. I can check that. But it looks like I have already stretched clang
> for my use to its maximum.
>
>
>
> --
> Warm Regards,
> Abhanshu
>
--
Warm Regards,
Abhanshu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120404/11d16377/attachment.html>
More information about the cfe-dev
mailing list