This patch makes the addons search also search the addon descriptions, allowing for more detailed searches. Very simple patch, only affects two lines.
Ok, but would do it a bit differently then (and as suggested by campbell, making a search cache could help here too, maybe build a set with all words from title + author + description when scanning addons, e.g.).
Will see that after release.
After investigating this, I don't think that performance is an issue.
I ran the attached performance test on all the addon author/name/description data, which runs the search a total of 20k times (10k with a findable search, 10k with a randomly generated string) and got the following result (I selected the worst-performing one):
$ python timer.py ('Searching 10k findable and 10k (probably) unfindable items takes:', 1.913896083831787, 'seconds')
Here is a quick cached implementation:
About speed: cached is about ten times quicker than uncached (~0.12sec instead of 1.2sec for 10K here, with all addons) - and without description search, uncached search is about five times slower (~0.7 secs)... So caching is worth it!
However, not sure clas var is OK here… Campbell, what do you say?
It makes sense to cache, but would be nice if we could throw away the cache too (when the UI is no longer active).
For this only - its not big deal, but rather each panel doesnt store cache for the entire blender session.
It could be made so the classes __del__ method can handle that, though at the moment IIRC the panel is created for each draw.
@Campbell yes, panels are recreated at each draw, that’s why I used the panel's class itself as storage… Not really good I know.
But anyway, I don't think we have any way to achieve a nice clearing of the cache currently, adding it to Space (if it was possible - afaik it is not currently) would not really solve it, since I think spaces are never freed once created (unless you close the related 'window', would work for userprefs, but…)?
I think its reasonable to have some way to free the cache at some point (when the window closes or the addons are navigated away from). but this means we have to add some way for the UI to handle cache.
We could look into a way to have some time-out which clears the cache, though currently Blender/Python thread stuff is risky business.