unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Po Lu <luangruo@yahoo.com>, Kai Ma <justksqsf@gmail.com>,
	71454@debbugs.gnu.org, Alan Third <alan@idiocy.org>,
	YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Subject: bug#71454: 30.0.50; Performance issues with font selection
Date: Sat, 28 Sep 2024 05:36:32 +0200	[thread overview]
Message-ID: <m234lkqwjj.fsf@pro2.fritz.box> (raw)
In-Reply-To: <86y13d8v3h.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 27 Sep 2024 09:32:50 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Kai Ma <justksqsf@gmail.com>
>> Date: Fri, 27 Sep 2024 00:42:04 +0200
>> 
>> I got back to this problem today and have some initial ideas.
>> 
>> I did some profiling and the profiler clearly shows that most CPU
>> time was in macfont_list and
>> CTFontDescriptorCreateMatchingFontDescriptors. (screenshot attached
>> below) So yes, it’s a Mac-only problem.
>> 
>> macfont_list will call CTFontDescriptorCreateMatchingFontDescriptors
>> for n times, where n is the number of installed fonts. It seems
>> CTFontDescriptorCreateMatchingFontDescriptors is very expensive, and
>> we should minimize the use of it.
>> 
>> I did a quick proof-of-concept patch (attached) that removes the
>> outer loop (utilizing CTFontDescriptorCreateMatchingFontDescriptors
>> itself to search for fonts). And now I no longer experience long
>> delays. It’s not complete as I haven’t adapted & incorporated
>> mac_font_create_preferred_family_for_attributes yet.
>> 
>> I don’t see noticeable font differences after the change on the
>> files I’m working on. I would like to gather some feedback from the
>> more experienced on whether this is a promising solution or not. If
>> it is, I will refine it into a formal patch.
>
> Thanks.  I'm adding a few people in the hope that they could comment
> on the patch, or maybe try it and provide feedback.

I haven't tried the patch because I can't reproduce the problem and I
don't use much beyond Latin-1 so I think chances are low that I'd see
anyting breaking with the patch.

But looking at the patch, which mostly removes stuff from macfont_list,
I wonder if/how that can be semeantically equalivalent to the existing
code.

Just saying, I'm definitely not an expert in this area.

Adding YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>, the original
author.





      parent reply	other threads:[~2024-09-28  3:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-09 18:56 bug#71454: 30.0.50; Performance issues with font selection Kai Ma
2024-06-09 22:10 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-09 22:17   ` Kai Ma
2024-06-09 22:34     ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-10  2:14       ` Kai Ma
2024-06-10 12:04         ` Eli Zaretskii
2024-06-09 23:10     ` Jim Porter
2024-06-10  2:18       ` Kai Ma
2024-06-10 11:53         ` Eli Zaretskii
2024-06-10 16:31           ` Jim Porter
2024-06-10 17:35             ` Eli Zaretskii
2024-06-10 11:55     ` Eli Zaretskii
2024-06-10 12:35       ` Kai Ma
2024-06-10 12:59         ` Eli Zaretskii
2024-06-10 16:42           ` Gerd Möllmann
2024-06-10 17:36             ` Kai Ma
2024-06-10 18:05               ` Gerd Möllmann
2024-06-10 11:58 ` Eli Zaretskii
2024-06-10 12:34   ` Kai Ma
2024-06-10 13:03     ` Eli Zaretskii
     [not found] ` <22612F93-FC37-48E8-8137-E9FF6F5B3A0D@gmail.com>
2024-09-27  6:32   ` Eli Zaretskii
2024-09-27  7:51     ` Kai Ma
2024-09-27 10:29       ` Eli Zaretskii
2024-09-28  3:36     ` Gerd Möllmann [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m234lkqwjj.fsf@pro2.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=71454@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=eliz@gnu.org \
    --cc=justksqsf@gmail.com \
    --cc=luangruo@yahoo.com \
    --cc=mituharu@math.s.chiba-u.ac.jp \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).