aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorMattias EngdegÄrd2023-11-21 12:27:42 +0100
committerMattias EngdegÄrd2024-01-13 20:50:38 +0100
commit3b00255a4c70bc1075446c94a8ff65c987ac143f (patch)
treec47f8d591ac87bdd1f8ca70c74d5aa11b6ac136c /src/image.c
parenta3ae5653cfe1ab2b3eb4c77ce729844ad442b562 (diff)
downloademacs-3b00255a4c70bc1075446c94a8ff65c987ac143f.tar.gz
emacs-3b00255a4c70bc1075446c94a8ff65c987ac143f.zip
Inlined and specialised hash table look-up
This improves performance in several ways. Separate functions are used depending on whether the caller has a hash value computed or not. * src/fns.c (hash_lookup_with_hash, hash_lookup_get_hash): New. (hash_lookup): Remove hash return argument. All callers adapted. hash_lookup_with_hash hash_hash_t arg
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/image.c b/src/image.c
index 55b027d568b..74d4b6c0bfe 100644
--- a/src/image.c
+++ b/src/image.c
@@ -6082,7 +6082,7 @@ xpm_put_color_table_h (Lisp_Object color_table,
6082 Lisp_Object chars = make_unibyte_string (chars_start, chars_len); 6082 Lisp_Object chars = make_unibyte_string (chars_start, chars_len);
6083 6083
6084 hash_hash_t hash_code; 6084 hash_hash_t hash_code;
6085 hash_lookup (table, chars, &hash_code); 6085 hash_lookup_get_hash (table, chars, &hash_code);
6086 hash_put (table, chars, color, hash_code); 6086 hash_put (table, chars, color, hash_code);
6087} 6087}
6088 6088
@@ -6093,7 +6093,7 @@ xpm_get_color_table_h (Lisp_Object color_table,
6093{ 6093{
6094 struct Lisp_Hash_Table *table = XHASH_TABLE (color_table); 6094 struct Lisp_Hash_Table *table = XHASH_TABLE (color_table);
6095 ptrdiff_t i = 6095 ptrdiff_t i =
6096 hash_lookup (table, make_unibyte_string (chars_start, chars_len), NULL); 6096 hash_lookup (table, make_unibyte_string (chars_start, chars_len));
6097 6097
6098 return i >= 0 ? HASH_VALUE (table, i) : Qnil; 6098 return i >= 0 ? HASH_VALUE (table, i) : Qnil;
6099} 6099}