all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Leo <sdl.web@gmail.com>
Cc: 12796@debbugs.gnu.org, Kim Storm <storm@cua.dk>
Subject: bug#12796: Optimize `ido-completing-read' for larger lists with flex matching enabled
Date: Thu, 08 Nov 2012 01:54:51 +0400	[thread overview]
Message-ID: <509AD8AB.90703@yandex.ru> (raw)
In-Reply-To: <m2obj9pujc.fsf@gmail.com>

On 07.11.2012 14:38, Leo wrote:
> On 2012-11-07 12:06 +0800, Dmitry Gutov wrote:
>> That was actually a good advice. As far as I can tell, most of the
>> speed improvement comes from the following change
>
> I seem to have some speedup on the flex matching part with the following
> patch.
>
> (tested on a ~9000 list with each item containing ~35 chars)
>
> ...

I've done some testing, see the setup and numbers at the end.

It looks like, with either patch, flex matching is not the bottleneck 
anymore. ido-hacks has some other functions changed or overridden, so if 
you're not satisfied with performance, you might want to look there.

(defun random-string (len)
   (let ((chars "1234567890abcdefghijklmnopqrstyvwxyz"))
     (apply 'string
            (loop for i from 1 to len
                  collect (aref chars (random (length chars)))))))

(defun random-dataset (size len)
   (loop for i from 1 to size
         collect (random-string len)))

(defmacro js2-time (form)
   "Evaluate FORM, discard result, and return elapsed time in sec"
   (declare (debug t))
   (let ((beg (make-symbol "--js2-time-beg--"))
         (delta (make-symbol "--js2-time-end--")))
     `(let ((,beg (current-time))
            ,delta)
        ,form
        (/ (truncate (* (- (float-time (current-time))
                           (float-time ,beg))
                        10000))
           10000.0))))

(defun ido-match-test (size len ido-text)
   (let ((items (random-dataset size len))
         (ido-cur-item 'list))
     (js2-time
      (ido-set-matches-1 items))))

;; *    size len        input  time
;; cis  9000 35 aaaaaaaaaa    0.06
;; cis 18000 15 aaaaaaaaaa    0.055
;; cis 18000 15 abcdefghzzzzz 0.057
;; omt  9000 35 aaaaaaaaaa    0.055 \
;; omt 18000 15 aaaaaaaaaa    0.054 + <- but the variance is bigger
;; omt 18000 15 abcdefghzzzzz 0.056 /
;; unp  9000 35 abcdefghzzzzz 0.82
;; unp 18000 15 abcdefghzzzzz 0.31

;; legend:
;; cis = ido-chars-in-string
;; ont = (split-string ido-text "" t)
;; unp = (split-string ido-text "")

;; bonus:
;; cis 18000 45 abcdefghzzz123 0.51
;; omt 18000 45 abcdefghzzz123 0.15
;; cis 18000 45 abcdefghzzz123 3.02





  reply	other threads:[~2012-11-07 21:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-04  5:58 bug#12796: Optimize `ido-completing-read' for larger lists with flex matching enabled Dmitry Gutov
2012-11-04  8:32 ` Leo
2012-11-04 13:53 ` Stefan Monnier
2012-11-04 17:05   ` Dmitry Gutov
2012-11-05  5:37     ` Dmitry Gutov
2012-11-06  1:45       ` Stefan Monnier
2012-11-06 11:03         ` Kim Storm
2012-11-06 15:38           ` Dmitry Gutov
2012-11-06 16:45             ` Kim Storm
2012-11-07  5:41           ` Dmitry Gutov
2012-11-05 20:57 ` Dmitry Gutov
2012-11-07  2:27   ` Leo
2012-11-07  4:06     ` Dmitry Gutov
2012-11-07 10:38       ` Leo
2012-11-07 21:54         ` Dmitry Gutov [this message]
2012-11-08  2:00           ` Leo
2012-11-08  4:14             ` Stefan Monnier
2012-11-08  7:36               ` Leo
2012-11-08 14:05                 ` Stefan Monnier
2012-11-10 17:52                   ` Dmitry Gutov
2012-11-10 22:51                     ` Stefan Monnier
2012-11-10 23:01                       ` Dmitry Gutov
2012-11-10 23:31                         ` Stefan Monnier
2020-09-13 16:14                       ` Lars Ingebrigtsen
2012-11-08  2:05       ` Stefan Monnier
2012-11-08  4:29         ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=509AD8AB.90703@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=12796@debbugs.gnu.org \
    --cc=sdl.web@gmail.com \
    --cc=storm@cua.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.