aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorMattias EngdegÄrd2023-11-02 17:05:26 +0100
committerMattias EngdegÄrd2024-01-13 20:50:38 +0100
commit7d93a0147a14e14d6964bf93ba11cf494b9d49fd (patch)
tree2cce6ad4b4476616e0be3dc1fcf5f68d2ae7692d /src/alloc.c
parent0a998938ca1b7e5e6f09d14b4a62ec7089be2af6 (diff)
downloademacs-7d93a0147a14e14d6964bf93ba11cf494b9d49fd.tar.gz
emacs-7d93a0147a14e14d6964bf93ba11cf494b9d49fd.zip
Share hash table test structs
This saves several words in the hash table object at the cost of an indirection at runtime. This seems to be a gain in overall performance. FIXME: We cache hash test objects in a rather clumsy way. A better solution is sought. * src/lisp.h (struct Lisp_Hash_Table): Use a pointer to the test struct. All references adapted. * src/alloc.c (garbage_collect): * src/fns.c (struct hash_table_user_test, hash_table_user_tests) (mark_fns, get_hash_table_user_test): New state for caching test structs, and functions managing it.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 7432163db25..16aaa32e15f 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5942,10 +5942,6 @@ purecopy_hash_table (struct Lisp_Hash_Table *table)
5942 *pure = *table; 5942 *pure = *table;
5943 pure->mutable = false; 5943 pure->mutable = false;
5944 5944
5945 pure->test.name = purecopy (table->test.name);
5946 pure->test.user_hash_function = purecopy (table->test.user_hash_function);
5947 pure->test.user_cmp_function = purecopy (table->test.user_cmp_function);
5948
5949 if (table->table_size > 0) 5945 if (table->table_size > 0)
5950 { 5946 {
5951 ptrdiff_t hash_bytes = table->table_size * sizeof *table->hash; 5947 ptrdiff_t hash_bytes = table->table_size * sizeof *table->hash;
@@ -6630,6 +6626,7 @@ garbage_collect (void)
6630#ifdef HAVE_NS 6626#ifdef HAVE_NS
6631 mark_nsterm (); 6627 mark_nsterm ();
6632#endif 6628#endif
6629 mark_fns ();
6633 6630
6634 /* Everything is now marked, except for the data in font caches, 6631 /* Everything is now marked, except for the data in font caches,
6635 undo lists, and finalizers. The first two are compacted by 6632 undo lists, and finalizers. The first two are compacted by
@@ -7295,9 +7292,6 @@ process_mark_stack (ptrdiff_t base_sp)
7295 { 7292 {
7296 struct Lisp_Hash_Table *h = (struct Lisp_Hash_Table *)ptr; 7293 struct Lisp_Hash_Table *h = (struct Lisp_Hash_Table *)ptr;
7297 set_vector_marked (ptr); 7294 set_vector_marked (ptr);
7298 mark_stack_push_value (h->test.name);
7299 mark_stack_push_value (h->test.user_hash_function);
7300 mark_stack_push_value (h->test.user_cmp_function);
7301 if (h->weakness == Weak_None) 7295 if (h->weakness == Weak_None)
7302 mark_stack_push_values (h->key_and_value, 7296 mark_stack_push_values (h->key_and_value,
7303 2 * h->table_size); 7297 2 * h->table_size);