unofficial mirror of emacs-devel@gnu.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; 8+ 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] 8+ messages in thread

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

Thread overview: 8+ 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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).