Hi, I have a proof of concept inverted index based accelerator for guix package search. The attached proof of concept script searches for packages whose description contains a certain query string, and achieves at least a 10x speedup (maybe more!) over brute force search. Example proof of concept script run below: Building index clock utime stime cutime cstime gctime 9.15 11.62 0.16 0.00 0.00 5.63 Brute force search clock utime stime cutime cstime gctime 0.12 0.12 0.00 0.00 0.00 0.00 Inverted index search clock utime stime cutime cstime gctime 0.00 0.00 0.00 0.00 0.00 0.00 * Method We iterate over all package descriptions, decompose them into trigrams (substrings of length 3), and build an "inverted index" -- a hash table mapping trigrams to package names. Building this index needs to be done only once, say during 'guix pull'. When the user provides a search string, we decompose the search string into trigrams and use the inverted index to look up packages whose descriptions contain those trigrams. For typical search strings, this only has an average complexity of O(1) whereas brute force search over all package descriptions scales as O(n). * Extension to regexp search The attached proof of concept script only works for exact string search. However, I can extend this to work for arbitrary regular expressions (see references) if there is sufficient interest to have this in Guix. I think performance of guix package search will become even more important as the number of packages in Guix grows. And, even as it is, guix package search is relatively slow. Having blazing fast package search could do wonders for user experience and user perception of Guix's speed! :-) WDYT? * References - https://en.wikipedia.org/wiki/Inverted_index - http://wonconsulting.com/~cho/papers/cho-regex.pdf - https://swtch.com/~rsc/regexp/regexp4.html Regards, Arun