From: Robert Pluim <rpluim@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Evgeny Zajcev <lg.zevlg@gmail.com>, 39133@debbugs.gnu.org
Subject: bug#39133: 28.0.50; Emacs slowdown on special char
Date: Tue, 14 Jan 2020 17:24:05 +0100 [thread overview]
Message-ID: <m2a76qropm.fsf@gmail.com> (raw)
In-Reply-To: <83lfqa5aa2.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 14 Jan 2020 17:26:45 +0200")
>>>>> On Tue, 14 Jan 2020 17:26:45 +0200, Eli Zaretskii <eliz@gnu.org> said:
>> From: Evgeny Zajcev <lg.zevlg@gmail.com>
>> Date: Tue, 14 Jan 2020 16:21:23 +0300
>>
>> I'm experiencing extreme Emacs slowdown when VARIATION SELECTOR-16 char
>> is used somewhere in Emacs buffer. For example, I just executed:
>>
>> (insert "a\xfe0f")
>>
>> in *scratch* buffer. Moving cursor (when this char is visible) become
>> unbearable. Here is the results of cpu profiling:
>>
>> - command-execute 776 62%
>> - call-interactively 776 62%
>> - funcall-interactively 675 54%
>> - previous-line 476 38%
>> - line-move 476 38%
>> - line-move-1 476 38%
>> + vertical-motion 225 18%
Eli> Does it help to set inhibit-compacting-font-caches non-nil?
>> As I remember I did not experienced something similar in Emacs 26/27
Eli> I don't think Emacs < 27 supported variation selectors, did it?
Itʼs coming from the caching in ftcrfont_glyph_extents:
row = glyph / METRICS_NCOLS_PER_ROW; <== glyph == 0xFFFFFFFF, row -> 0x1FFFFFF
col = glyph % METRICS_NCOLS_PER_ROW;
if (row >= ftcrfont_info->metrics_nrows)
{
ftcrfont_info->metrics =
xrealloc (ftcrfont_info->metrics,
sizeof (struct font_metrics *) * (row + 1));
memset (ftcrfont_info->metrics + ftcrfont_info->metrics_nrows, 0,
(sizeof (struct font_metrics *)
* (row + 1 - ftcrfont_info->metrics_nrows)));
ftcrfont_info->metrics_nrows = row + 1; <=== weʼre updating
metrics_nrows, lets look in ftfont.h
}
ftfont.h:
#ifdef USE_CAIRO
cairo_scaled_font_t *cr_scaled_font;
/* Scale factor from the bitmap strike metrics in 1/64 pixels, used
as the hb_position_t value in HarfBuzz, to those in (scaled)
pixels. The value is 0 for scalable fonts. */
double bitmap_position_unit;
/* Font metrics cache. */
struct font_metrics **metrics;
short metrics_nrows;
^^^^^ oops! Now we end up calling xrealloc every time we enter
ftctfont_glyph_extents for that glyph.
Of course, I donʼt think glyph should be 0xFFFFFFFF, but thatʼs a
different problem.
Robert
next prev parent reply other threads:[~2020-01-14 16:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-14 13:21 bug#39133: 28.0.50; Emacs slowdown on special char Evgeny Zajcev
2020-01-14 15:26 ` Eli Zaretskii
2020-01-14 16:24 ` Robert Pluim [this message]
2020-01-15 4:26 ` YAMAMOTO Mitsuharu
2020-01-15 8:25 ` Robert Pluim
2020-01-15 10:47 ` Evgeny Zajcev
2020-01-15 16:19 ` Eli Zaretskii
2020-01-24 10:13 ` Robert Pluim
2020-01-24 10:22 ` Eli Zaretskii
2020-01-24 13:09 ` Robert Pluim
2020-01-24 13:40 ` Eli Zaretskii
2020-01-24 13:50 ` Robert Pluim
2020-01-24 15:41 ` Robert Pluim
2020-01-24 15:52 ` Eli Zaretskii
2020-03-02 7:40 ` Robert Pluim
2020-03-02 8:49 ` Eli Zaretskii
2020-03-02 9:25 ` Robert Pluim
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=m2a76qropm.fsf@gmail.com \
--to=rpluim@gmail.com \
--cc=39133@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=lg.zevlg@gmail.com \
/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).