[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/hash-table-perf 441c4d53cf6 31/35: Don't pretend that hash-table
From: |
Mattias Engdegård |
Subject: |
scratch/hash-table-perf 441c4d53cf6 31/35: Don't pretend that hash-table-size is useful |
Date: |
Fri, 12 Jan 2024 10:53:26 -0500 (EST) |
branch: scratch/hash-table-perf
commit 441c4d53cf6c1736cde9562ded8918afec85c8bd
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 4edc761cfab..640e4f3ab0a 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 1fa798beae1..69a22ccefde 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 7eb780cb839..997389885a1 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -5499,10 +5499,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);
- scratch/hash-table-perf b96f48232ac 11/35: ; * src/lisp.h (struct Lisp_Hash_Table): Add ASCII art., (continued)
- scratch/hash-table-perf b96f48232ac 11/35: ; * src/lisp.h (struct Lisp_Hash_Table): Add ASCII art., Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf d7dbbc74a00 13/35: * src/print.c (print_object): Don't print empty hash-table data, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf 9b39cee78e3 12/35: * src/print.c (print_object): Don't print hash table test if `eql`., Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf 08acca67739 14/35: Don't print or read the hash table size parameter, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf b1218be258a 18/35: Allow zero hash table size, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf 8f608cb4a1c 28/35: Use key Qunbound instead of hash value hash_unused for free entries, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf 93d6326e6c0 32/35: Hash-table documentation updates, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf 1462fca6dce 16/35: Remove rehash-threshold and rehash-size struct members, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf 3b3fea97ecc 22/35: Use hash_idx_t for storing hash indices, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf 58559a83827 29/35: * src/lisp.h (hash_hash_t): Change to uint32_t., Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf 441c4d53cf6 31/35: Don't pretend that hash-table-size is useful,
Mattias Engdegård <=
- scratch/hash-table-perf a0560e90d3b 26/35: Change hash_idx_t to int32_t on all platforms, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf 8ec0e030b66 35/35: Combine hash and next vector into a single array, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf b9a0b88aea8 05/35: ; * src/fns.c (collect_interval): Move misplaced function., Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf ed4ce0af9a9 06/35: Refactor: extract hash and index computations to functions, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf e55fcdafa07 09/35: Abstract predicate and constant for unused hash keys, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf 594152bf667 01/35: Add internal hash-table debug functions, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf 422c91a822a 02/35: ; * src/pdumper.c (dump_hash_table): Remove unused argument., Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf f2d6e2713c0 07/35: Refactor hash table vector reallocation, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf dd4ee2c634b 15/35: Represent hash table weakness as an enum internally, Mattias Engdegård, 2024/01/12
- scratch/hash-table-perf 615d3e4cdc6 17/35: Leaner hash table dumping and thawing, Mattias Engdegård, 2024/01/12