emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wondering about FACE_CACHE_BUCKETS_SIZE


From: Win Treese
Subject: Wondering about FACE_CACHE_BUCKETS_SIZE
Date: Tue, 9 Feb 2021 21:53:34 -0500

I happened to be looking at some code in src/xfaces.c on the trunk, and I
noticed this at lines 289-292:

/* Size of hash table of realized faces in face caches (should be a
   prime number).  */

#define FACE_CACHE_BUCKETS_SIZE 1001

1001 isn’t prime (it’s 7*11*13). A quick look at the hash table code
suggest that the main effect of it is to slow things down a little bit
because some hash buckets would get used more often than they
would be with a prime. 

From the git log, it’s been this way since the code was first committed
in 1999.

There’s probably no real problem here, except that the comment and
code don’t match. On the other hand, 997 and 1009 are nice nearby
primes if it really matters.

 - Win




reply via email to

[Prev in Thread] Current Thread [Next in Thread]