server
server copied to clipboard
🔨 Make zone:queryEntitiesByName() fast
- [x] I have paid attention to this example and will edit again if need be to not break the formatting, or I will be ignored
- [x] I have searched existing issues to see if the issue has already been opened, and I have checked the commit log to see if the issue has been resolved since my server was last updated
- [x] I have read and understood the Contributing Guide
Describe the feature
We're currently getting a lot of use and safety out of zone:queryEntitiesByName() but the current implementation is $O(n)$. We need to bring this down to at worst $O(log n)$, but more likely $O(1)$.
We'll probably want to populate a std::unordered_map<std::string, std::vector<CLuaEntity>> at startup, and use that for our lookups.
This however won't work for dynamic entities, so we'd also need a way to force the linear search by name.