1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 15:27:34 +00:00

Assistant: Cache results for each query by provider

Previously, results were cached for each query in a single list.
The majority of CPU time was spent determining which items in the
cache had been seen previously. This commit removes the need to
check previous results by holding a separate list of results for each
provider type.

This makes Assistant feel much more responsive to user input,
especially when the filesystem has a lot of files.
This commit is contained in:
Tim Ledbetter 2023-01-07 17:46:34 +00:00 committed by Jelle Raaijmakers
parent 634d1e0197
commit d9aa7eacc6
3 changed files with 52 additions and 37 deletions

View file

@ -153,7 +153,7 @@ public:
void build_filesystem_cache();
private:
RefPtr<Threading::BackgroundAction<NonnullRefPtrVector<Result>>> m_fuzzy_match_work;
RefPtr<Threading::BackgroundAction<Optional<NonnullRefPtrVector<Result>>>> m_fuzzy_match_work;
bool m_building_cache { false };
Vector<DeprecatedString> m_full_path_cache;
Queue<DeprecatedString> m_work_queue;