VMM/common: Improve search_address complexity
Checking the dictionary (a hash) for existence of a key is likely to be
O(log(n)), while checking a list is O(n). Therefore, to increase
performance, this patch changes the check accordingly.
--- a/VirtualMailManager/common.py Tue Aug 07 23:55:41 2012 +0000
+++ b/VirtualMailManager/common.py Wed Aug 08 14:37:29 2012 +0000
@@ -251,7 +251,7 @@
gids = []
daddrs = {}
for gid, address, addrtype, aliasdomain in result:
- if gid not in gids:
+ if gid not in daddrs:
gids.append(gid)
daddrs[gid] = []
daddrs[gid].append((address, addrtype, aliasdomain))