[cfe-dev] Improving Clang Parse Performance

sccllghn sccllghn at yahoo.com
Mon Jun 11 10:16:27 PDT 2012


I am trying to use Clang for parsing some C++ programs and have had good
success. The problem is performance. I can parse about 400,000 lines of C
code scattered in 400 files in about 25 minutes on a really fast machine. I
think that this is not very good, considering that I am doing a lot less
than a compiler. Am I mistaken in my expectations?

My sense is that to get a real bump in performance, I need to use
pre-compiled header files, because the vast majority of parsing is being
done over and over. However, my initial experience with pch has not been
successful. It isn't clear to me how to go about doing this in a practical
situation. Do I need to write a small pre-processing step that identifies
what the included files are for each source file and then pre-compile them
with the same set of pre-processor directives? Is it better to pre-compile
groups of header files together or to pre-compile each header files
separately?

Any suggestions that will get me headed in the right direction will be most
helpful.

--
View this message in context: http://clang-developers.42468.n3.nabble.com/Improving-Clang-Parse-Performance-tp4024407.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list