[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/hash-table-perf 8cd35079f4c 34/35: Don't pretend that hash-table
From: |
Mattias Engdegård |
Subject: |
scratch/hash-table-perf 8cd35079f4c 34/35: Don't pretend that hash-table-size is useful |
Date: |
Thu, 4 Jan 2024 10:56:44 -0500 (EST) |
branch: scratch/hash-table-perf
commit 8cd35079f4c30c6372dd76b146dff7513f1c755f
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 6253e1d64f5..7f724f2f4e7 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 c4df6041de8 12/35: * src/print.c (print_object): Don't print hash table test if `eql`., (continued)
- scratch/hash-table-perf c4df6041de8 12/35: * src/print.c (print_object): Don't print hash table test if `eql`., Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf f3e985a16ba 14/35: Don't print or read the hash table size parameter, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 1ebd00f6d0a 21/35: Retype hash interfaces to use EMACS_UINT instead of Lisp fixnum, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf fc68176120f 24/35: Use hash_hash_t for storing hash values, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 4b5d9f92abe 13/35: * src/print.c (print_object): Don't print empty hash-table data, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 310f6584ccb 18/35: Allow zero hash table size, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf e53398ab698 26/35: ; Reorder structs (hash and test), Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 4e8d7725fd4 11/35: ; * src/fns.c (Fmake_hash_table): ensure `test` is a bare symbol, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 8335891387a 22/35: Inlined and specialised hash table look-up, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 54807fee4d0 23/35: Use hash_idx_t for storing hash indices, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 8cd35079f4c 34/35: Don't pretend that hash-table-size is useful,
Mattias Engdegård <=
- scratch/hash-table-perf e6defe82569 27/35: Change default hash table size to 8 (from 65), Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 422c91a822a 02/35: ; * src/pdumper.c (dump_hash_table): Remove unused argument., Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 3d2042c48a6 07/35: Refactor: extract hash index computation to a function, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf c188b9f2bf5 08/35: Refactor hash table vector reallocation, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 6ffbccbf1dd 15/35: Represent hash table weakness as an enum internally, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 3e9e68333ae 16/35: Remove rehash-threshold and rehash-size struct members, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 8e80d1930e3 20/35: Store hash values as EMACS_UINT instead of Lisp_Object, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 05297736aa6 33/35: Adapt hash functions to produce a hash_hash_t eventually, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 830838eb5f3 31/35: Use KEY=Qunbound instead of HASH=hash_unused for unused entries, Mattias Engdegård, 2024/01/04
- scratch/hash-table-perf 8b1b140bed9 32/35: * src/lisp.h (hash_hash_t): Change to uint32_t., Mattias Engdegård, 2024/01/04