Commit 17af43ca authored by Paul Eggert's avatar Paul Eggert

Minor weak hash table performance tweaks

* src/fns.c (make_hash_table): Omit unnecessary assignment to
h->next_weak when the hash table is not weak.
(copy_hash_table): Put the copy next to the original in the
weak_hash_tables list, as this should have better locality
when scanning the weak hash tables.
parent 83c9c6fc
...@@ -3756,9 +3756,7 @@ make_hash_table (struct hash_table_test test, EMACS_INT size, ...@@ -3756,9 +3756,7 @@ make_hash_table (struct hash_table_test test, EMACS_INT size,
eassert (XHASH_TABLE (table) == h); eassert (XHASH_TABLE (table) == h);
/* Maybe add this hash table to the list of all weak hash tables. */ /* Maybe add this hash table to the list of all weak hash tables. */
if (NILP (h->weak)) if (! NILP (weak))
h->next_weak = NULL;
else
{ {
h->next_weak = weak_hash_tables; h->next_weak = weak_hash_tables;
weak_hash_tables = h; weak_hash_tables = h;
...@@ -3788,8 +3786,8 @@ copy_hash_table (struct Lisp_Hash_Table *h1) ...@@ -3788,8 +3786,8 @@ copy_hash_table (struct Lisp_Hash_Table *h1)
/* Maybe add this hash table to the list of all weak hash tables. */ /* Maybe add this hash table to the list of all weak hash tables. */
if (!NILP (h2->weak)) if (!NILP (h2->weak))
{ {
h2->next_weak = weak_hash_tables; h2->next_weak = h1->next_weak;
weak_hash_tables = h2; h1->next_weak = h2;
} }
return table; return table;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment