Endilll wrote:

Physical separation of parts of `Sema` while improving incremental compile 
times means we have to rely on forward declarations, which lead to additional 
level of indirection at runtime in the form of `Sema` containing pointers to 
its components, and components containing a reference back into `Sema`.

Here's an implementation of an getter function for a `Sema` component:
```cpp
  SemaOpenACC &OpenACC() {
    assert(OpenACCPtr);
    return *OpenACCPtr;
  }
``` 

In order to test compile-time performance implications of introducing a level 
of indirection, I put together a prototype that moves a dozen of name lookup 
routines that are on a hot code paths into `SemaLookup` in the same way this 
patch does for OpenACC routines. Patch is available [in my 
fork](https://github.com/llvm/llvm-project/commit/de88ffc757c03e4da83293f729e441864b2f4bda).
 Results are the following:
1) Indirection doesn't seem to introduce any noticeable regressions. Almost all 
benchmarks exhibit <0.1% change _in both directions-, which I consider noise: 
https://llvm-compile-time-tracker.com/compare.php?from=e85470232ba2fa49aaee83240741de0bc82a3ffa&to=86d182ab233261563a1ce90c195c9071e76dacc4&stat=instructions:u
2) No noticeable regression occur even if we make getter out-of-line on top of 
the previous test, including stage2 clang build, which is done by stage1 clang 
built without LTO: 
https://llvm-compile-time-tracker.com/compare.php?from=86d182ab233261563a1ce90c195c9071e76dacc4&to=6510e5d4cfa7104b89fdf096dda1c8a6d26c044b&stat=instructions:u

My conclusion is that this refactoring is unlikely to introduce regressions for 
compile-time performance.

https://github.com/llvm/llvm-project/pull/84184
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to