From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: reducing equality tests in displaying text Date: Fri, 23 Jan 2009 11:23:00 +0900 Organization: Faculty of Science, Chiba University Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1232677395 4840 80.91.229.12 (23 Jan 2009 02:23:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 23 Jan 2009 02:23:15 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 23 03:24:28 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 1LQBid-0001rW-VI for ged-emacs-devel@m.gmane.org; Fri, 23 Jan 2009 03:24:28 +0100 Original-Received: from localhost ([127.0.0.1]:46503 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQBhM-0006I6-4R for ged-emacs-devel@m.gmane.org; Thu, 22 Jan 2009 21:23:08 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LQBhH-0006Hf-Hr for emacs-devel@gnu.org; Thu, 22 Jan 2009 21:23:03 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LQBhH-0006HS-8A for emacs-devel@gnu.org; Thu, 22 Jan 2009 21:23:03 -0500 Original-Received: from [199.232.76.173] (port=46879 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQBhG-0006HP-Vt for emacs-devel@gnu.org; Thu, 22 Jan 2009 21:23:03 -0500 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:58905) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LQBhG-0002oG-99 for emacs-devel@gnu.org; Thu, 22 Jan 2009 21:23:02 -0500 Original-Received: from church.math.s.chiba-u.ac.jp (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 7A2692C5F for ; Fri, 23 Jan 2009 11:23:00 +0900 (JST) User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) X-detected-operating-system: by monty-python.gnu.org: NetBSD 3.0 (DF) 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:108125 Archived-At: 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. 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. 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. 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. BTW, I suspect Ffontset_font is broken. I couldn't get any meaningful result from (fontset-font t ?a), for example. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp