Quote:
Originally Posted by kiwidude
Ok, I found the problem thanks to the loan of drMerry's database. It is caused when you have a very large number of duplicates in the group. The problem isn't the search algorithms themselves but the code afterwards which repartitions the groups taking into account exemptions. The performance of this is diabolical in the situation of having say 70 duplicate titles in the group, so something badly wrong in there. Will post a new version when I figure out the exact cause and fix it or dump the approach in favour of another.
|
One thing that has bitten me is using the 'in' operator on lists. The operator does a linear search! One piece of code I wrote improved in performance by two orders of magnitude when I changed the list to a set, which does hashed lookups. Sometimes I use a dict with a fixed value (e.g. True) for the same thing, because they are hashed as well.