# HG changeset patch # User martin f. krafft # Date 1344436649 0 # Node ID cd1200d067000f3c3cccbbfde764cece93c3fb38 # Parent ffd24974ed68f788a63d31313dc1b59d5c5ae49c 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. diff -r ffd24974ed68 -r cd1200d06700 VirtualMailManager/common.py --- 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))