[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/obarray 0a1c9810065 1/9: Internal function for obarray performan
From: |
Mattias Engdegård |
Subject: |
scratch/obarray 0a1c9810065 1/9: Internal function for obarray performance analysis (bug#68244) |
Date: |
Mon, 12 Feb 2024 09:10:53 -0500 (EST) |
branch: scratch/obarray
commit 0a1c98100653a21b7093e56f32b311148348fa96
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
Internal function for obarray performance analysis (bug#68244)
* src/lread.c (Finternal__obarray_buckets): New function.
---
src/lread.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/lread.c b/src/lread.c
index b5eeb55bb70..5277932f255 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -5294,6 +5294,32 @@ OBARRAY defaults to the value of `obarray'. */)
return Qnil;
}
+DEFUN ("internal--obarray-buckets",
+ Finternal__obarray_buckets, Sinternal__obarray_buckets, 1, 1, 0,
+ doc: /* Symbols in each bucket of OBARRAY. Internal use only. */)
+ (Lisp_Object obarray)
+{
+ obarray = check_obarray (obarray);
+ ptrdiff_t size = ASIZE (obarray);
+ Lisp_Object ret = Qnil;
+ for (ptrdiff_t i = 0; i < size; i++)
+ {
+ Lisp_Object bucket = Qnil;
+ Lisp_Object sym = AREF (obarray, i);
+ if (BARE_SYMBOL_P (sym))
+ while (1)
+ {
+ bucket = Fcons (sym, bucket);
+ struct Lisp_Symbol *s = XBARE_SYMBOL(sym)->u.s.next;
+ if (!s)
+ break;
+ sym = make_lisp_symbol (s);
+ }
+ ret = Fcons (Fnreverse (bucket), ret);
+ }
+ return Fnreverse (ret);
+}
+
#define OBARRAY_SIZE 15121
void
@@ -5691,6 +5717,7 @@ syms_of_lread (void)
defsubr (&Sget_file_char);
defsubr (&Smapatoms);
defsubr (&Slocate_file_internal);
+ defsubr (&Sinternal__obarray_buckets);
DEFVAR_LISP ("obarray", Vobarray,
doc: /* Symbol table for use by `intern' and `read'.
- branch scratch/obarray created (now d6af4455d72), Mattias Engdegård, 2024/02/12
- scratch/obarray 82cf3ab0edf 2/9: Make minibuf-tests independent of obarray hash order, Mattias Engdegård, 2024/02/12
- scratch/obarray aa6f6434342 3/9: lread.c: Use bare symbol operations, Mattias Engdegård, 2024/02/12
- scratch/obarray 05e8b01d8c4 6/9: add obarray-clear and use it, Mattias Engdegård, 2024/02/12
- scratch/obarray 0a1c9810065 1/9: Internal function for obarray performance analysis (bug#68244),
Mattias Engdegård <=
- scratch/obarray 0e821664f89 4/9: use obarray-make instead of make-vector, Mattias Engdegård, 2024/02/12
- scratch/obarray 3997133bf13 5/9: use obarrayp, not vectorp, to detect obarrays, Mattias Engdegård, 2024/02/12
- scratch/obarray d6af4455d72 9/9: Use obarray object for initial obarray, Mattias Engdegård, 2024/02/12
- scratch/obarray 2fd9f17a063 7/9: remove check of obarray-default-size in tests, Mattias Engdegård, 2024/02/12
- scratch/obarray 37fdb9d87f3 8/9: add PVEC_OBARRAY and use it for obarray functions, Mattias Engdegård, 2024/02/12