João Távora writes: > So, backed by the new ability to conduct good benchmarks, I looked at > the problem anew. I found some insight in the problem, and came up with > a new "lazy-hilit" patch which performs just as well, if not slightly > better, than Daniel's, while keeping the changes to lisp/minibuffer.el > much more minimal and not adding replacement for the longstanding > completion-all-completions. Working on this a bit more, I've now been able to optimize the "lazy hilit" patch even further by recognizing that in many situations we don't need to match the "PCM" pattern to each string twice. The first time we do it, we can calculate a score immediately and store it in the string. The average response times for the "yo-yoo" test described previously: master: 2.604s 2021 lazy-hilit patch: 1.240s 2023 Daniel+Dmitry: 0.831s 2023 lazy-hilit v1: 0.792s And the new one: 2023 lazy-hilit v2: 0.518s I'm now keeping my work in a branch called feature/completion-lazy-hilit, but I still attach the diff here. João PS: for the flex style in particular, there are even more optimizations possible. For example one could take advantage of the fact that in flex, a longer pattern should always yield a subset of the completions produced by a shorter pattern in the same completion session. But this requires solid concepts of a "completion session".