From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: sva-news@mygooglest.com, 15876@debbugs.gnu.org
Subject: bug#15876: 24.3.50; Highly degraded performance between rev 114715 and 115006
Date: Wed, 11 Dec 2013 18:28:31 +0200 [thread overview]
Message-ID: <83ob4nwdw0.fsf@gnu.org> (raw)
In-Reply-To: <52A80BA8.3050403@yandex.ru>
> Date: Wed, 11 Dec 2013 10:52:24 +0400
> From: Dmitry Antipov <dmantipov@yandex.ru>
> CC: sva-news@mygooglest.com
>
> IMO the real problem is that redisplay sometimes isn't clever enough about requesting
> font for the particular character (0x25b7 in our case):
Not sure if this is for redisplay to solve. Redisplay just needs a
face for displaying a character, it knows (almost) nothing about fonts
and fontsets. It's the font selection machinery that needs to become
smarter, I think.
> Such a request produces a lot of font-entity objects, which are not needed (and becomes
> reachable only via font cache) after the "best match" font is selected for the particular
> character. Next, if font loading is too memory-intensive and gc_cons_threshold was hit, GC
> clears font cache. Next cursor movement triggers redisplay, which in turn asks for the "best
> match" for 0x25b7 again. If font cache is never cleared, this is acceptable because all possible
> matches (represented as a vector of font-entities) are cached. But, if font cache is cleared,
> font_list_entities calls to driver->list function, which creates a lot of font-entities again,
> etc., etc.
Right, this matches my observations. Did you succeed in finding which
function in this call sequence is the performance bottleneck?
> Until we have somewhat smarter redisplay, possible solution is to clear font cache when it
> becomes larger than some specified size rather than at each GC. Now I have the virtual machine
> with Windows 7 installed, and this fix looks reasonable for me. Could you also please try it?
It solves the immediate problem with this single character, but if I
add a few others from other Unicode blocks, the problem reappears.
This is because the threshold of 4096 seems to be too low: I've seen
the number go above 10K a couple of times.
Anyway, what about the patch below? With it, the problem disappears
even without your "threshold" based GC.
We could be even more aggressive, and search also the face caches on
all frames (but then, if found, the face needs to be cached on the
current frame as well, before using it) -- this is left as an
exercise ;-)
The problem with this approach is that there's no guarantee we will
find a "best-match" font for a character. However, I displayed
etc/HELLO with and without the patch, and didn't see any difference.
Maybe some font selection expert could tell if we lose anything
important by going this way. Note that NS was already reusing the
argument FACE (but it alone) in this way.
--- src/fontset.c~ 2013-11-05 06:42:21.000000000 +0200
+++ src/fontset.c 2013-12-11 11:30:03.909213300 +0200
@@ -937,7 +937,6 @@
if (ASCII_CHAR_P (c) || face->fontset < 0)
return face->ascii_face->id;
-#ifdef HAVE_NS
if (face->font)
{
/* Fonts often have characters in other scripts, like symbol, even if they
@@ -946,9 +945,22 @@
perhaps be general? */
Lisp_Object font_object;
XSETFONT (font_object, face->font);
- if (font_has_char (f, font_object, c)) return face->id;
+ if (font_has_char (f, font_object, c))
+ return face->id;
+ }
+
+ for (face_id = 0; face_id < FRAME_FACE_CACHE (f)->used; face_id++)
+ {
+ struct face *this_face = FACE_FROM_ID (f, face_id);
+
+ if (this_face != face && this_face->font)
+ {
+ Lisp_Object font_object;
+ XSETFONT (font_object, this_face->font);
+ if (font_has_char (f, font_object, c))
+ return this_face->id;
+ }
}
-#endif
eassert (fontset_id_valid_p (face->fontset));
fontset = FONTSET_FROM_ID (face->fontset);
next prev parent reply other threads:[~2013-12-11 16:28 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-12 15:32 bug#15876: 24.3.50; Highly degraded performance between rev 114715 and 115006 Sebastien Vauban
2013-11-12 17:11 ` Glenn Morris
[not found] ` <wzwqkdfsts.fsf-iW7gFb+/I3LZHJUXO5efmti2O/JbrIOy@public.gmane.org>
2013-11-12 19:13 ` Sebastien Vauban
2013-11-13 11:43 ` Dani Moncayo
[not found] ` <mailman.5954.1384343055.10748.bug-gnu-emacs@gnu.org>
2013-11-13 13:58 ` Sebastien Vauban
[not found] ` <mailman.5925.1384283656.10748.bug-gnu-emacs@gnu.org>
[not found] ` <mailman.5925.1384283656.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-11-13 14:04 ` Sebastien Vauban
2013-11-13 16:11 ` Eli Zaretskii
[not found] ` <83fvr01du4.fsf-mXXj517/zsQ@public.gmane.org>
2013-11-13 20:23 ` Sebastien Vauban
2013-11-13 20:35 ` Eli Zaretskii
2013-11-14 3:05 ` Glenn Morris
[not found] ` <jxeh6j1y4x.fsf-iW7gFb+/I3LZHJUXO5efmti2O/JbrIOy@public.gmane.org>
2013-11-14 10:05 ` Sebastien Vauban
[not found] ` <mailman.6048.1384423574.10748.bug-gnu-emacs@gnu.org>
2013-11-14 10:13 ` Sebastien Vauban
2013-11-14 17:04 ` Glenn Morris
[not found] ` <mailman.6048.1384423574.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-11-19 22:52 ` Sebastien Vauban
2013-11-20 1:47 ` Stefan Monnier
2013-11-20 3:53 ` Eli Zaretskii
2013-11-20 3:48 ` Eli Zaretskii
[not found] ` <mailman.6579.1384912163.10748.bug-gnu-emacs@gnu.org>
[not found] ` <mailman.6579.1384912163.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-11-20 8:48 ` Sebastien Vauban
[not found] ` <mailman.6575.1384901595.10748.bug-gnu-emacs@gnu.org>
[not found] ` <mailman.6575.1384901595.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-11-20 22:32 ` Sebastien Vauban
2013-11-21 3:42 ` Eli Zaretskii
[not found] ` <mailman.6739.1385005456.10748.bug-gnu-emacs@gnu.org>
[not found] ` <mailman.6739.1385005456.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-11-26 20:52 ` Sebastien Vauban
2013-11-26 21:04 ` Eli Zaretskii
[not found] ` <mailman.7212.1385499914.10748.bug-gnu-emacs@gnu.org>
[not found] ` <mailman.7212.1385499914.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-11-29 21:01 ` Sebastien Vauban
2013-12-01 16:31 ` Eli Zaretskii
2013-12-02 10:45 ` Dmitry Antipov
2013-12-02 11:43 ` Dmitry Antipov
2013-12-02 18:00 ` Eli Zaretskii
2013-12-02 17:52 ` Eli Zaretskii
2013-12-03 9:57 ` Dmitry Antipov
2013-12-03 13:16 ` Eli Zaretskii
2013-12-03 15:09 ` Dmitry Antipov
2013-12-04 17:53 ` Eli Zaretskii
2013-12-05 6:29 ` Dmitry Antipov
2013-12-05 17:36 ` Eli Zaretskii
2013-12-11 6:52 ` Dmitry Antipov
2013-12-11 7:16 ` bug#15876: [SPAM] " Jarek Czekalski
2013-12-11 9:24 ` Dmitry Antipov
2013-12-11 16:28 ` Eli Zaretskii [this message]
2013-12-11 18:00 ` Dmitry Antipov
2013-12-11 18:12 ` Eli Zaretskii
2013-12-11 19:50 ` Jan Djärv
2013-12-13 15:22 ` Eli Zaretskii
2013-12-13 16:12 ` Dmitry Antipov
2013-12-13 16:45 ` Stefan Monnier
2013-12-13 18:53 ` Eli Zaretskii
2013-12-13 18:44 ` Eli Zaretskii
2013-12-16 8:05 ` Dmitry Antipov
2013-12-13 16:50 ` Stefan Monnier
2013-12-13 18:55 ` Eli Zaretskii
2013-12-14 2:13 ` Stefan Monnier
2013-12-14 8:47 ` Jan Djärv
[not found] ` <mailman.7746.1385915595.10748.bug-gnu-emacs@gnu.org>
[not found] ` <mailman.7746.1385915595.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-12-01 20:20 ` Sebastien Vauban
2013-12-01 20:37 ` Eli Zaretskii
[not found] ` <mailman.7763.1385930292.10748.bug-gnu-emacs@gnu.org>
[not found] ` <mailman.7763.1385930292.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-12-01 21:51 ` Sebastien Vauban
2013-12-02 3:45 ` Eli Zaretskii
[not found] ` <mailman.7786.1385955973.10748.bug-gnu-emacs@gnu.org>
[not found] ` <mailman.7786.1385955973.10748.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-12-02 9:29 ` Sebastien Vauban
2013-11-13 16:52 ` Stefan Monnier
2013-11-14 11:03 ` Jarek Czekalski
2013-11-14 16:35 ` 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=83ob4nwdw0.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=15876@debbugs.gnu.org \
--cc=dmantipov@yandex.ru \
--cc=sva-news@mygooglest.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 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.