aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2017-02-21 15:31:29 -0800
committerPaul Eggert2017-02-21 15:39:17 -0800
commit17af43ca76692c7e889c91d3fa9e6690349f0d57 (patch)
treebc0cfd0dbe36db16a03daf13d62eceeaeca12211 /src
parent83c9c6fc1cc943f239a021b42a8ca9b0e162198c (diff)
downloademacs-17af43ca76692c7e889c91d3fa9e6690349f0d57.tar.gz
emacs-17af43ca76692c7e889c91d3fa9e6690349f0d57.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/fns.c b/src/fns.c
index 9668c885ab6..0b694529c52 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3756,9 +3756,7 @@ make_hash_table (struct hash_table_test test, EMACS_INT size,
3756 eassert (XHASH_TABLE (table) == h); 3756 eassert (XHASH_TABLE (table) == h);
3757 3757
3758 /* Maybe add this hash table to the list of all weak hash tables. */ 3758 /* Maybe add this hash table to the list of all weak hash tables. */
3759 if (NILP (h->weak)) 3759 if (! NILP (weak))
3760 h->next_weak = NULL;
3761 else
3762 { 3760 {
3763 h->next_weak = weak_hash_tables; 3761 h->next_weak = weak_hash_tables;
3764 weak_hash_tables = h; 3762 weak_hash_tables = h;
@@ -3788,8 +3786,8 @@ copy_hash_table (struct Lisp_Hash_Table *h1)
3788 /* Maybe add this hash table to the list of all weak hash tables. */ 3786 /* Maybe add this hash table to the list of all weak hash tables. */
3789 if (!NILP (h2->weak)) 3787 if (!NILP (h2->weak))
3790 { 3788 {
3791 h2->next_weak = weak_hash_tables; 3789 h2->next_weak = h1->next_weak;
3792 weak_hash_tables = h2; 3790 h1->next_weak = h2;
3793 } 3791 }
3794 3792
3795 return table; 3793 return table;