Subject: bug#25995: 26.0.50; Mismatch between documented and actual behaviour of icomplete

From: Dmitry Gutov <[email-masked]>
Date: Wed, 21 Jun 2017 05:04:51 +0300

On 6/19/17 6:28 AM, [email-masked] wrote:

> 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.

Thank you for the benchmark file. Indeed, in batch mode my results are 
similar to yours:

dolist+push 1000
Elapsed time: 0.000135s
dolist+push 10000
Elapsed time: 0.001112s
dolist+push 100000
Elapsed time: 0.011830s
dolist+push+nreverse 1000
Elapsed time: 0.000130s
dolist+push+nreverse 10000
Elapsed time: 0.001084s
dolist+push+nreverse 100000
Elapsed time: 0.011518s
cl-delete-if 1000
Elapsed time: 0.001173s
cl-delete-if 10000
Elapsed time: 0.001621s
cl-delete-if 100000
Elapsed time: 0.017909s

When running it interactively, however (M-x eval-buffer, also starting 
with 'emacs -Q'), I'm getting consistently opposite results:

dolist+push 1000
Elapsed time: 0.000836s
dolist+push 10000
Elapsed time: 0.007698s
dolist+push 100000
Elapsed time: 0.045281s
dolist+push+nreverse 1000
Elapsed time: 0.000512s
dolist+push+nreverse 10000
Elapsed time: 0.007719s
dolist+push+nreverse 100000
Elapsed time: 0.186524s (0.140654s in 1 GCs)
cl-delete-if 1000
Elapsed time: 0.002603s
cl-delete-if 10000
Elapsed time: 0.003347s
cl-delete-if 100000
Elapsed time: 0.021793s

In any case, nreverse barely affects the runtime, so please go ahead and 
push the patch. Thanks!