[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 13 10:37:42 PST 2018


kadircet added inline comments.


================
Comment at: clangd/index/Background.h:121
   bool ShouldStop = false;
-  std::deque<Task> Queue;
+  std::list<std::pair<Task, ThreadPriority>> Tasks;
   std::vector<std::thread> ThreadPool; // FIXME: Abstract this away.
----------------
ilya-biryukov wrote:
> kadircet wrote:
> > ilya-biryukov wrote:
> > > Why not `std::deque`?
> > because we can insert in the middle of the queue now, when we skip existing high priority tasks. 
> `deque::insert` is `O(smaller of the distances to either begin or end)` and we spend the same time on the linear search anyway.
> I believe we can keep it, even though I'm not strictly sure which is more efficient (we certainly don't care)
Cool, didn't know that. If that's the case we definitely don't care.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55315/new/

https://reviews.llvm.org/D55315





More information about the cfe-commits mailing list