all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Win Treese <treese@acm.org>
To: emacs-devel@gnu.org
Subject: Wondering about FACE_CACHE_BUCKETS_SIZE
Date: Tue, 9 Feb 2021 21:53:34 -0500	[thread overview]
Message-ID: <673E9F11-29F6-4F5B-B754-34FD9776DDB6@acm.org> (raw)


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	other threads:[~2021-02-10  2:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10  2:53 Win Treese [this message]
2021-02-10  9:08 ` Wondering about FACE_CACHE_BUCKETS_SIZE tomas
2021-02-10 16:11 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=673E9F11-29F6-4F5B-B754-34FD9776DDB6@acm.org \
    --to=treese@acm.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.