[modules] Cache 'acceptable decl' lookups for namespaces. In projects with
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 17 Feb 2016 21:52:44 +0000 (21:52 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 17 Feb 2016 21:52:44 +0000 (21:52 +0000)
commit4083e038e918ccc1a5800f424c3e814bdd425e79
treef254d8df01cd7aecb0931cbcbc83d47129756e76
parentd4590c7304575702731b00749ae22e1298a98eba
[modules] Cache 'acceptable decl' lookups for namespaces. In projects with
thousands of modules, each of which declares the same namespace, linearly
scanning the redecl chain looking for a visible declaration (once for each leaf
module, for each use) performs very poorly. Namespace visibility can only
decrease when we leave a module during a module build step, and we never care
*which* visible declaration of a namespace we find, so we can cache this very
effectively.

This results in a 35x speedup on one of our internal build steps (2m -> 3.5s),
but is hard to unit test because it requires a very large number of modules.
Ideas for a test appreciated! No functionality change intended other than the
speedup.

llvm-svn: 261161
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaLookup.cpp