Removed slow search for existing selectionlist items
When the selectionlist is filled with more than just a few items (445 artists in my case) they appear really slowly in the UI. This is caused by a slow search for existing items. In update_values
there are len(self._model) * len(values)
comparisons. This method also calls add_value
which looks for existing items again. So 2 * len(self._model) * len(values)
comparisons in total.
My changes instead create a set of item ids and look up ids of new items there. I also removed the unnecessary thread for populate
and simplified add_values
.