From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: reducing equality tests in displaying text Date: Tue, 27 Jan 2009 14:26:42 +0900 Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1233034014 556 80.91.229.12 (27 Jan 2009 05:26:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 27 Jan 2009 05:26:54 +0000 (UTC) Cc: emacs-devel@gnu.org To: YAMAMOTO Mitsuharu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 27 06:28:06 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LRgUW-0007dx-Co for ged-emacs-devel@m.gmane.org; Tue, 27 Jan 2009 06:28:04 +0100 Original-Received: from localhost ([127.0.0.1]:38882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRgTE-0005fI-GX for ged-emacs-devel@m.gmane.org; Tue, 27 Jan 2009 00:26:44 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LRgTA-0005dE-Fg for emacs-devel@gnu.org; Tue, 27 Jan 2009 00:26:40 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LRgT8-0005Ze-Go for emacs-devel@gnu.org; Tue, 27 Jan 2009 00:26:39 -0500 Original-Received: from [199.232.76.173] (port=56256 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRgT8-0005ZW-Ds for emacs-devel@gnu.org; Tue, 27 Jan 2009 00:26:38 -0500 Original-Received: from mx1.aist.go.jp ([150.29.246.133]:38278) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LRgT7-0001qh-Pz for emacs-devel@gnu.org; Tue, 27 Jan 2009 00:26:38 -0500 Original-Received: from rqsmtp1.aist.go.jp (rqsmtp1.aist.go.jp [150.29.254.115]) by mx1.aist.go.jp with ESMTP id n0R5QZIq008880; Tue, 27 Jan 2009 14:26:35 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp1.aist.go.jp by rqsmtp1.aist.go.jp with ESMTP id n0R5QZql011500; Tue, 27 Jan 2009 14:26:35 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp1.aist.go.jp with ESMTP id n0R5QZDK003429; Tue, 27 Jan 2009 14:26:35 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken with local (Exim 4.69) (envelope-from ) id 1LRgTC-00080l-6Q; Tue, 27 Jan 2009 14:26:42 +0900 In-reply-to: (message from YAMAMOTO Mitsuharu on Fri, 23 Jan 2009 11:23:00 +0900) X-detected-operating-system: by monty-python.gnu.org: Solaris 9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:108288 Archived-At: In article , YAMAMOTO Mitsuharu writes: > I experimented with some performance tool and noticed that there were > frequent equality tests in displaying text. I think most of them can > safely be reduced. Thank you for the report. > 1. Each call of assoc_no_quit (charset,_encoding_charset_alist) in > fontset.c can be replaced with assq_no_quit because > Vfont_encoding_charset_alist is a symbol-keyed alist. Yes, just fixed. > 2. Also in fontset.c: > 472 if (c >= 0) > 473 font_group = char_table_ref_and_range (base_fontset, c, &from, &to); > 474 else > 475 font_group = FONTSET_FALLBACK (base_fontset); > 476 if (NILP (font_group)) > 477 return Qnil; > If `font_group' becomes Qnil in line 473, `from' and `to' are not > used at all. So the most of the task of char_table_ref_and_range > is wasted for this case. Because font_group == Qnil case happens > frequently, the char_table_ref_and_range call should be avoided for > this case. When font_group is Qnil, in most cases, SUB_CHAR_TABLE_P (table) is zero. Thus the calculation of FROM and TO must not be that slow. Did you really see the bottle-neck of the performance here? > 3. Despite its argument name, `has_char' functions in font backend > drivers are mostly called for a font object instead of a font > entity. Some font backend drivers could make use of this fact: > e.g., ftfont_has_char can avoid frequent assoc_no_quit calls if > struct ft_font has a reference to fc_charset in ft_face_cache. I've just fixed ftfont_has_char to use FT_Get_Char_Index directly. > BTW, I suspect Ffontset_font is broken. I couldn't get any meaningful > result from (fontset-font t ?a), for example. I fixed it too. --- Kenichi Handa handa@m17n.org