bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: npostavs
Subject: bug#25995: 26.0.50; Mismatch between documented and actual behaviour of icomplete
Date: Sun, 18 Jun 2017 23:28:52 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)

Dmitry Gutov <address@hidden> writes:

> On 3/10/17 1:25 AM, address@hidden 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

Attachment: bench-filter.el
Description: benchmark code


reply via email to

[Prev in Thread] Current Thread [Next in Thread]