[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 519c7ca7356 19/20: Don't pretend that hash-table-size is useful
From: |
Mattias Engdegård |
Subject: |
master 519c7ca7356 19/20: Don't pretend that hash-table-size is useful |
Date: |
Sat, 13 Jan 2024 14:54:03 -0500 (EST) |
branch: master
commit 519c7ca7356fc7f9707b97c143c9495deea5b272
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
Don't pretend that hash-table-size is useful
* lisp/emacs-lisp/shortdoc.el (hash-table): Remove hash-table-size entry.
* doc/lispref/hash.texi (Other Hash):
* src/fns.c (Fhash_table_size): Make it clear that hash-table-size is
probably not worth using.
---
doc/lispref/hash.texi | 3 ++-
lisp/emacs-lisp/shortdoc.el | 5 +----
src/fns.c | 12 ++++++++----
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/doc/lispref/hash.texi b/doc/lispref/hash.texi
index ff9d1799a60..aeaeab27fc0 100644
--- a/doc/lispref/hash.texi
+++ b/doc/lispref/hash.texi
@@ -386,5 +386,6 @@ This returns the rehash threshold of @var{table}.
@end defun
@defun hash-table-size table
-This returns the current nominal size of @var{table}.
+This returns the current allocation size of @var{table}. Since hash table
+allocation is managed automatically, this is rarely of interest.
@end defun
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index 17cbf6b2d31..a6a49c72f74 100644
--- a/lisp/emacs-lisp/shortdoc.el
+++ b/lisp/emacs-lisp/shortdoc.el
@@ -572,10 +572,7 @@ A FUNC form can have any number of `:no-eval' (or
`:no-value'),
:result-string "#s(hash-table ...)")
(hash-table-count
:no-eval (hash-table-count table)
- :eg-result 15)
- (hash-table-size
- :no-eval (hash-table-size table)
- :eg-result 65))
+ :eg-result 15))
(define-short-documentation-group list
"Making Lists"
diff --git a/src/fns.c b/src/fns.c
index 3765fc74967..70288590e24 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -5518,10 +5518,14 @@ DEFUN ("hash-table-rehash-threshold",
Fhash_table_rehash_threshold,
DEFUN ("hash-table-size", Fhash_table_size, Shash_table_size, 1, 1, 0,
- doc: /* Return the size of TABLE.
-The size can be used as an argument to `make-hash-table' to create
-a hash table than can hold as many elements as TABLE holds
-without need for resizing. */)
+ doc: /* Return the current allocation size of TABLE.
+
+This is probably not the function that you are looking for. To get the
+number of entries in a table, use `hash-table-count' instead.
+
+The returned value is the number of entries that TABLE can currently
+hold without growing, but since hash tables grow automatically, this
+number is rarely of interest. */)
(Lisp_Object table)
{
struct Lisp_Hash_Table *h = check_hash_table (table);
- master 49fd4d120de 07/20: Allow zero hash table size, (continued)
- master 49fd4d120de 07/20: Allow zero hash table size, Mattias Engdegård, 2024/01/13
- master c3d0cc50faf 05/20: Remove rehash-threshold and rehash-size struct members, Mattias Engdegård, 2024/01/13
- master a3ae5653cfe 09/20: Store hash values as integers instead of Lisp_Object, Mattias Engdegård, 2024/01/13
- master ed06de52a53 14/20: Faster hash table growth, starting at zero size, Mattias Engdegård, 2024/01/13
- master fa5c07fc87d 08/20: Use non-Lisp allocation for internal hash-table vectors, Mattias Engdegård, 2024/01/13
- master 7ad5d427730 16/20: Don't dump Qunbound, Mattias Engdegård, 2024/01/13
- master d2c3a983146 20/20: Hash-table documentation updates (bug#68244), Mattias Engdegård, 2024/01/13
- master a09619f2598 02/20: * src/print.c (print_object): Don't print empty hash-table data, Mattias Engdegård, 2024/01/13
- master 3f9c81a87f7 03/20: Don't print or read the hash table size parameter, Mattias Engdegård, 2024/01/13
- master d3cefd3e983 06/20: Leaner hash table dumping and thawing, Mattias Engdegård, 2024/01/13
- master 519c7ca7356 19/20: Don't pretend that hash-table-size is useful,
Mattias Engdegård <=
- master 3b00255a4c7 10/20: Inlined and specialised hash table look-up, Mattias Engdegård, 2024/01/13
- master 1998039f7a8 18/20: Change hash_hash_t to uint32_t, Mattias Engdegård, 2024/01/13
- master 7d93a0147a1 12/20: Share hash table test structs, Mattias Engdegård, 2024/01/13
- master 47502c55b0c 13/20: ; Reorder struct Lisp_Hash_Table and struct hash_table_test, Mattias Engdegård, 2024/01/13
- master c6bdc1ea1dc 04/20: Represent hash table weakness as an enum internally, Mattias Engdegård, 2024/01/13
- master 68f8bc31114 15/20: Change hash_idx_t to int32_t on all platforms, Mattias Engdegård, 2024/01/13
- master 0a998938ca1 11/20: Use hash_idx_t for storing hash indices, Mattias Engdegård, 2024/01/13
- master 11e467eb600 17/20: Use key Qunbound instead of hash value hash_unused for free entries, Mattias Engdegård, 2024/01/13