================ @@ -1159,12 +1256,29 @@ class Sema; return reinterpret_cast<T *>(FreeSpaceStart); } + template <typename T> T *allocateDeferredCandidate() { + T *C = slabAllocate<T>(1); ---------------- erichkeane wrote:
Seems funny to me to `slab` allocate in increments of 1. I have a 'silly' idea... Since 'deferred candidates' are likely to only be a handful per lookup... I wonder if we could: 1- Add a few-bits to `DeferredTemplateOverloadCandidate` for `leftInSlab`. 2- on `!FirstDeferredCandidate`, allocate (say)4 items. Set the 1st item to '3' left. 3- Then, find the last candidate the same way. if `leftInSlab` != 0, emplacement-new/etc into the 'next' location, set the `leftInSlab` to be the previous `-1`. If `leftInSlab == 0`, allocate. I realize it is more work here, and can be done in a followup, but there might be a mild perf improvement for cache locality. I suspect if we set this to something like 4, which requires 2 bits in the structure, high-90%s of lookups will take only 1 allocation. WDYT? https://github.com/llvm/llvm-project/pull/133426 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits