From: Eli Zaretskii Date: Sun, 16 Apr 2017 07:43:22 +0000 (+0300) Subject: Fix redisplay performance problems with some fonts X-Git-Tag: emacs-26.0.90~521^2~622 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=58430f29968a5661caff630d20dbbe7c864fe08d;p=emacs.git Fix redisplay performance problems with some fonts * src/font.c (font_list_entities): Revert part of the changes introduced on Apr 2, 2014 to fix bug#17125. It turns out having zero_vector in the font-cache is an important indication that cannot be removed. (Bug#21028) --- diff --git a/src/font.c b/src/font.c index a929509752c..dd6191b2b1f 100644 --- a/src/font.c +++ b/src/font.c @@ -2777,21 +2777,27 @@ font_list_entities (struct frame *f, Lisp_Object spec) val = XCDR (val); else { - val = driver_list->driver->list (f, scratch_font_spec); - if (!NILP (val)) - { - Lisp_Object copy = copy_font_spec (scratch_font_spec); + Lisp_Object copy; - val = Fvconcat (1, &val); - ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); - XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); - } + val = driver_list->driver->list (f, scratch_font_spec); + /* We put zero_vector in the font-cache to indicate that + no fonts matching SPEC were found on the system. + Failure to have this indication in the font cache can + cause severe performance degradation in some rare + cases, see bug#21028. */ + if (NILP (val)) + val = zero_vector; + else + val = Fvconcat (1, &val); + copy = copy_font_spec (scratch_font_spec); + ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); + XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); } - if (VECTORP (val) && ASIZE (val) > 0 + if (ASIZE (val) > 0 && (need_filtering || ! NILP (Vface_ignored_fonts))) val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size); - if (VECTORP (val) && ASIZE (val) > 0) + if (ASIZE (val) > 0) list = Fcons (val, list); }