[PATCH] D13987: Postpone module macro update until all headers are parsed.

Serge Pavlov via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 09:38:47 PDT 2015


sepavloff created this revision.
sepavloff added a subscriber: cfe-commits.

This change fixes performance degradation reported in PR24667. The reason
of the problem is leaving module after each header, even if the next header
is of the same module. With this fix module state record counts the number of
headers parsed within particular module. Macro update starts when this number
reaches the number of headers specified in the module descriptor.

Using script from PR24667 the performance measurement gives numbers (compile
time vs number of headers):

128     0.0362679958344
256     0.0517950057983
512     0.0877501964569
1024    0.171896934509
2048    0.393149137497
4096    1.02584791183
8192    3.1531829834

While without the fix compiler demonstrates quadratic compile time:

128     0.0541491508484
256     0.121176958084
512     0.330996990204
1024    1.10708594322
2048    4.06581497192
4096    16.0358121395
8192    66.6967120171

http://reviews.llvm.org/D13987

Files:
  include/clang/Lex/Preprocessor.h
  lib/Lex/PPLexerChange.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13987.38141.patch
Type: text/x-patch
Size: 4854 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151022/472faa7a/attachment-0001.bin>


More information about the cfe-commits mailing list