[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 17af43c 4/4: Minor weak hash table performance twea
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 17af43c 4/4: Minor weak hash table performance tweaks |
Date: |
Tue, 21 Feb 2017 18:39:24 -0500 (EST) |
branch: master
commit 17af43ca76692c7e889c91d3fa9e6690349f0d57
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
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.
---
src/fns.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/fns.c b/src/fns.c
index 9668c88..0b69452 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3756,9 +3756,7 @@ make_hash_table (struct hash_table_test test, EMACS_INT
size,
eassert (XHASH_TABLE (table) == h);
/* Maybe add this hash table to the list of all weak hash tables. */
- if (NILP (h->weak))
- h->next_weak = NULL;
- else
+ if (! NILP (weak))
{
h->next_weak = weak_hash_tables;
weak_hash_tables = h;
@@ -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. */
if (!NILP (h2->weak))
{
- h2->next_weak = weak_hash_tables;
- weak_hash_tables = h2;
+ h2->next_weak = h1->next_weak;
+ h1->next_weak = h2;
}
return table;