mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-16 13:48:04 +00:00
Reduce queue lengths by running index updates as iteration loop
A single translation unit can create many index updates, so give IndexMain_DoCreateIndexUpdate a chance to run a few times. This should also be faster as it is more icache friendly.
This commit is contained in:
parent
ef59e59f5b
commit
1fd0a1be94
@ -452,9 +452,15 @@ bool IndexMain_DoParse(
|
||||
|
||||
bool IndexMain_DoCreateIndexUpdate(TimestampManager* timestamp_manager) {
|
||||
auto* queue = QueueManager::instance();
|
||||
|
||||
bool did_work = false;
|
||||
IterationLoop loop;
|
||||
while (loop.Next()) {
|
||||
optional<Index_OnIdMapped> response = queue->on_id_mapped.TryPopFront();
|
||||
if (!response)
|
||||
return false;
|
||||
return did_work;
|
||||
|
||||
did_work = true;
|
||||
|
||||
Timer time;
|
||||
|
||||
@ -511,8 +517,9 @@ bool IndexMain_DoCreateIndexUpdate(TimestampManager* timestamp_manager) {
|
||||
|
||||
Index_OnIndexed reply(std::move(update), response->perf);
|
||||
queue->on_indexed.PushBack(std::move(reply), response->is_interactive);
|
||||
}
|
||||
|
||||
return true;
|
||||
return did_work;
|
||||
}
|
||||
|
||||
bool IndexMain_LoadPreviousIndex() {
|
||||
|
Loading…
Reference in New Issue
Block a user