Dmitry Gutov writes: > On 3/10/17 1:25 AM, npostavs@users.sourceforge.net wrote: > >> --- i/lisp/minibuffer.el >> +++ w/lisp/minibuffer.el >> @@ -3257,7 +3257,7 @@ completion-pcm--filename-try-filter >> "\\)\\'"))) >> (dolist (f all) >> (unless (string-match-p re f) (push f try))) >> - (or try all)))) >> + (or (nreverse try) all)))) > > Looks good to me, thank you. > > But what are the chances of this 'nreverse' (or the whole function) > being performance-significant? > > Maybe we could switch this code to `cl-delete-if'. From my testing, > it's considerably faster than dolist+push (even without nreverse). I don't have a good sense of how the completion code fits together, so I'm not sure how significant the performance of this function is, but in my simplistic benchmark I found the opposite: dolist+push+nreverse is quite a bit faster (although the difference can be swamped by GC). So adding `nreverse' won't be a problem. ~/src$ emacs -Q -batch -l emacs/bench-filter.elc dolist+push 1000 Elapsed time: 0.000335s dolist+push 10000 Elapsed time: 0.001951s dolist+push 100000 Elapsed time: 0.056526s (0.035910s in 1 GCs) dolist+push+nreverse 1000 Elapsed time: 0.000212s dolist+push+nreverse 10000 Elapsed time: 0.002086s dolist+push+nreverse 100000 Elapsed time: 0.019966s cl-delete-if 1000 Elapsed time: 0.002174s cl-delete-if 10000 Elapsed time: 0.003604s cl-delete-if 100000 Elapsed time: 0.034759s