emacs-devel
[Top][All Lists]
Advanced

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

Re: What does all-completions with COLLECTION == obarray return?


From: Michael Heerdegen
Subject: Re: What does all-completions with COLLECTION == obarray return?
Date: Sun, 05 Apr 2015 20:48:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> >  (length obarray)
>
> Doesn't do what you think.  An obarray is a vector, and this just
> returns the number of buckets in the hash-table.

Thanks, my imagination of obarray was indeed wrong.

I continued debugging, and found out that when following the recipe in
helm I posted, the obarray seems to be filled with more and more symbols
- with only a few names.

I wrote this test function:

--8<---------------cut here---------------start------------->8---
(defun my-find-doubles ()
  (let ((table (make-hash-table :size 65000 :test #'equal)))
    (mapatoms (lambda (symbol) (if (gethash (symbol-name symbol) table)
                              (message "%S" (symbol-name symbol))
                            (puthash (symbol-name symbol) t table))))))
--8<---------------cut here---------------end--------------->8---

I would expect that whenever it gets called, it produces no output.

Before running the recipe, it indeed prints nothing.  But after the
first time:

"Bahá'í Date"
"Insert Bahá'í"
"…"

These three symbol names all include non-ascii chars, sorry if they
should have been posted incorrectly.

The effect seems to be exponential or worse, soon I see:


"Bahá'í Date" [8191 times]
"Insert Bahá'í" [8191 times]
"…" [8191 times]

after a few more trials.

What could be happening here?


Thanks,

Michael.




reply via email to

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