all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* obarray confusion
@ 2010-10-27 21:21 Sean McAfee
       [not found] ` <87sjzr8boe.fsf@kuiper.lan.informatimago.com>
  2010-10-29 19:00 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Sean McAfee @ 2010-10-27 21:21 UTC (permalink / raw
  To: help-gnu-emacs

(mapatoms (lambda (s) (incf n))) tells me I have 43061 symbols defined.
(length obarray) tells me the standard obarray has a size of 1511.

My understanding is that an obarray is essentially a hash table with
collision chaining.  But this would mean that the linked list of symbols
in each bucket has an average length of 43061 / 1511 ≈ 28.

Emacs's symbol lookup couldn't possibly be that inefficient, could it?


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

* Re: obarray confusion
       [not found] ` <87sjzr8boe.fsf@kuiper.lan.informatimago.com>
@ 2010-10-29 10:12   ` David Kastrup
  2010-10-29 10:46     ` Pascal J. Bourguignon
  0 siblings, 1 reply; 4+ messages in thread
From: David Kastrup @ 2010-10-29 10:12 UTC (permalink / raw
  To: help-gnu-emacs

pjb@informatimago.com (Pascal J. Bourguignon) writes:

> Sean McAfee <eefacm@gmail.com> writes:
>
>> (mapatoms (lambda (s) (incf n))) tells me I have 43061 symbols defined.
>> (length obarray) tells me the standard obarray has a size of 1511.
>>
>> My understanding is that an obarray is essentially a hash table with
>> collision chaining.  But this would mean that the linked list of symbols
>> in each bucket has an average length of 43061 / 1511 ≈ 28.
>>
>> Emacs's symbol lookup couldn't possibly be that inefficient, could it?
>
> Symbols are interned only when they are read, which doesn't occur often.

28 is quite the bucket size.  If the average bucket size is larger than
1 for the dumped Emacs already, that's just a case of bad defaults, and
of course it should affect byte compilation times quite a bit.

-- 
David Kastrup


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

* Re: obarray confusion
  2010-10-29 10:12   ` David Kastrup
@ 2010-10-29 10:46     ` Pascal J. Bourguignon
  0 siblings, 0 replies; 4+ messages in thread
From: Pascal J. Bourguignon @ 2010-10-29 10:46 UTC (permalink / raw
  To: help-gnu-emacs

David Kastrup <dak@gnu.org> writes:

> pjb@informatimago.com (Pascal J. Bourguignon) writes:
>
>> Sean McAfee <eefacm@gmail.com> writes:
>>
>>> (mapatoms (lambda (s) (incf n))) tells me I have 43061 symbols defined.
>>> (length obarray) tells me the standard obarray has a size of 1511.
>>>
>>> My understanding is that an obarray is essentially a hash table with
>>> collision chaining.  But this would mean that the linked list of symbols
>>> in each bucket has an average length of 43061 / 1511 ≈ 28.
>>>
>>> Emacs's symbol lookup couldn't possibly be that inefficient, could it?
>>
>> Symbols are interned only when they are read, which doesn't occur often.
>
> 28 is quite the bucket size.  If the average bucket size is larger than
> 1 for the dumped Emacs already, that's just a case of bad defaults, and
> of course it should affect byte compilation times quite a bit.

Obviously, emacs is optimized for editing, not for compiling ;-)

I agree that the size of the obarray should adapt to its content.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/


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

* Re: obarray confusion
  2010-10-27 21:21 obarray confusion Sean McAfee
       [not found] ` <87sjzr8boe.fsf@kuiper.lan.informatimago.com>
@ 2010-10-29 19:00 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2010-10-29 19:00 UTC (permalink / raw
  To: help-gnu-emacs

> (mapatoms (lambda (s) (incf n))) tells me I have 43061 symbols defined.
> (length obarray) tells me the standard obarray has a size of 1511.

> My understanding is that an obarray is essentially a hash table with
> collision chaining.  But this would mean that the linked list of symbols
> in each bucket has an average length of 43061 / 1511 ≈ 28.

That's right.

> Emacs's symbol lookup couldn't possibly be that inefficient, could it?

I think it not only could.


        Stefan


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

end of thread, other threads:[~2010-10-29 19:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-27 21:21 obarray confusion Sean McAfee
     [not found] ` <87sjzr8boe.fsf@kuiper.lan.informatimago.com>
2010-10-29 10:12   ` David Kastrup
2010-10-29 10:46     ` Pascal J. Bourguignon
2010-10-29 19:00 ` Stefan Monnier

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.