all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* What does all-completions with COLLECTION == obarray return?
@ 2015-04-04 16:43 Michael Heerdegen
  2015-04-05  4:12 ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Heerdegen @ 2015-04-04 16:43 UTC (permalink / raw)
  To: Emacs Development

Hello,

in emacs -Q,

(cons
 (length obarray)
 (length (all-completions "" obarray)))

    ==> (1511 . 15039)

I don't understand why the second value is so much larger than the
first.  I would expect as many completions as interned symbols.


Some background:

In helm, we've found a really weird bug.  If you repeatedly evaluate,
with helm-mode on, the following:

--8<---------------cut here---------------start------------->8---
(let* ((hi-lock-face-defaults
        (list
         "hi-yellow"
         "hi-pink"
         "hi-green"
         "hi-blue"
         "hi-black-b"
         "hi-blue-b"
         "hi-red-b"
         "hi-green-b"
         "hi-black-hb")))
  (completing-read
   (format "Highlight using face (default %s): "
           (car hi-lock-face-defaults))
   (all-completions "" obarray)
   'facep t nil 'face-name-history hi-lock-face-defaults))
--8<---------------cut here---------------end--------------->8---

(just say C-g at each prompt), after ten or so iterations, it gets slow,
every time it takes twice as long as before until the prompt appears.
Soon it gets completely unusable freezing Emacs for a minute.

I debugged this and found out that after performing this test,
(all-completions "" obarray) does return a list with ~ a million
elements.  Since we use all-completions to create a candidate list for
completion, we have a million candidates then, and this is what makes
Helm slow.

(length (all-completions "" obarray)) seems to grow exponentially for
every iteration of the above code, but obarray remains constant in size.

What could be happening here?


Thanks,

Michael.



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-04-15 17:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-04 16:43 What does all-completions with COLLECTION == obarray return? Michael Heerdegen
2015-04-05  4:12 ` Stefan Monnier
2015-04-05 18:48   ` Michael Heerdegen
2015-04-06  4:01     ` Stefan Monnier
2015-04-08  9:42       ` Michael Heerdegen
2015-04-08 13:46         ` Stefan Monnier
2015-04-08 16:38           ` Michael Heerdegen
2015-04-15 13:56             ` Michael Heerdegen
2015-04-15 15:14               ` bug#20334: " Stefan Monnier
2015-04-15 15:30                 ` Andreas Schwab
2015-04-15 16:15                 ` Stefan Monnier
2015-04-15 17:24                   ` Michael Heerdegen

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.