-
Notifications
You must be signed in to change notification settings - Fork 26
Closed
Labels
refactoringCode refactoringCode refactoring
Description
Registry collector search сomputational complexity is O(N) where N is quantity of collectors
Line 18 in 925708a
for _, c in ipairs(self.collectors) do |
But Lua has hash tables, and with them we can search with O(1) at most times (and it's not like hash collision will happen often with standard number of collectors). All we need is to use kind+name key instead of plain array, i.e.
{ [ kind1 .. name1] = collector1, ... }
instead of
{ [1] = collector1 }
since kind+name must be unique. Moreover, it is more common to search for user collectors, but in registry array they always will be placed after default collectors, so it will be .
yngvar-antonsson and opomuc
Metadata
Metadata
Assignees
Labels
refactoringCode refactoringCode refactoring