emacs-devel
[Top][All Lists]
Advanced

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

Re: Q: BLV for function slots + BL obarray/hmap for symbol lookup?


From: Arthur Miller
Subject: Re: Q: BLV for function slots + BL obarray/hmap for symbol lookup?
Date: Sun, 30 May 2021 04:57:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt)

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Arthur Miller <arthur.miller@live.com> writes:
>
>
>> (setq-local obarray (copy-sequence obarray))
>                        ^^^^^^^^^^^^^
>
> I guess this is something different than with the originally suggested
> `obarray-copy'.
>
> I once was told that obarray is not just simply an array of existing
> symbols

You mean I got a shallow copy of the obarray instead of a deep copy?

Where do I find this obarray-copy? :-) I don't see it in 27.1.

>  (length obarray) ==> 15121

Yes, I get the same apocalytpic number, surprise :).

>  (let ((i 0)) (mapatoms (lambda (_) (cl-incf i))) i) ==> 66002

I get 45416.

This is beyond my knowledge about how obarrays in Emacs are made. I just
looked quickly in the source and see that make-obarray is in principle
just a wrapper for (make-vector size 0), which then calls into
make_vector in C code, so obviouslu the vector is allocated elsewhere
since the length is a prime number. I guess it is just the number of
predefined slots in the vector for hashing, not the actually numer of
symbols in the array? I guess just buckets for chaining? I am not sure
how to interpret the second number from mapatoms, collisions? :) But I
am probably wrong, just speculating.






reply via email to

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