1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-06 00:51:00 +01:00

libstore: use set instead of list for waiter list

This replaces the O(n) search complexity in our insert code with a
lookup of O(log n). It also makes removing waitees easier as we can use
the extract method provided by the set class.
This commit is contained in:
Andreas Rammhold 2021-08-08 01:47:08 +02:00
parent 2b67cb7b8c
commit a9cb1ca32c
2 changed files with 5 additions and 10 deletions

View file

@ -19,7 +19,7 @@ struct CompareGoalPtrs {
/* Set of goals. */
typedef set<GoalPtr, CompareGoalPtrs> Goals;
typedef list<WeakGoalPtr> WeakGoals;
typedef set<WeakGoalPtr, std::owner_less<WeakGoalPtr>> WeakGoals;
/* A map of paths to goals (and the other way around). */
typedef std::map<StorePath, WeakGoalPtr> WeakGoalMap;