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: Wed, 28 Jan 2009 16:03:01 +0900 Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1233126195 23741 80.91.229.12 (28 Jan 2009 07:03:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Jan 2009 07:03:15 +0000 (UTC) Cc: emacs-devel@gnu.org To: YAMAMOTO Mitsuharu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 28 08:04: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 1LS4TL-000149-J8 for ged-emacs-devel@m.gmane.org; Wed, 28 Jan 2009 08:04:28 +0100 Original-Received: from localhost ([127.0.0.1]:47672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LS4S3-00056T-99 for ged-emacs-devel@m.gmane.org; Wed, 28 Jan 2009 02:03:07 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LS4Rw-00054E-1L for emacs-devel@gnu.org; Wed, 28 Jan 2009 02:03:00 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LS4Ru-00053I-ND for emacs-devel@gnu.org; Wed, 28 Jan 2009 02:02:59 -0500 Original-Received: from [199.232.76.173] (port=57246 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LS4Ru-00052z-HM for emacs-devel@gnu.org; Wed, 28 Jan 2009 02:02:58 -0500 Original-Received: from mx1.aist.go.jp ([150.29.246.133]:56438) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LS4Rt-000717-IQ for emacs-devel@gnu.org; Wed, 28 Jan 2009 02:02:58 -0500 Original-Received: from rqsmtp2.aist.go.jp (rqsmtp2.aist.go.jp [150.29.254.123]) by mx1.aist.go.jp with ESMTP id n0S72rhN006072; Wed, 28 Jan 2009 16:02:53 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp4.aist.go.jp by rqsmtp2.aist.go.jp with ESMTP id n0S72rfo013926; Wed, 28 Jan 2009 16:02:53 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp4.aist.go.jp with ESMTP id n0S72qfl023286; Wed, 28 Jan 2009 16:02:52 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken with local (Exim 4.69) (envelope-from ) id 1LS4Rx-0000hD-GW; Wed, 28 Jan 2009 16:03:01 +0900 In-reply-to: (message from YAMAMOTO Mitsuharu on Wed, 28 Jan 2009 09:12:40 +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:108323 Archived-At: In article , YAMAMOTO Mitsuharu writes: >>>>>> On Tue, 27 Jan 2009 14:26:42 +0900, Kenichi Handa said: >>> 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. > There's another occurrence in font_for_char. Oops, just fixed. > > 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? > Below is a part of the result of an experiment (after your change) > with Shark.app on Mac OS X 10.5.6. I scrolled up and down the Japanese > tutorial. Emacs is compiled with Xft support and the default CFLAGS > (-g -O2 -Wno-pointer-sign). > 957.8 ms emacs mark_object > 194.3 ms emacs mark_vectorlike > 147.9 ms emacs Fgarbage_collect > 145.3 ms libfreetype.6.dylib tt_cmap4_char_map_binary > 108.9 ms emacs char_table_ref_and_range > 98.8 ms emacs sub_char_table_ref_and_range Are you sure that those calls mostly return nil? Could you please check if this patch surely improve the performance? *** fontset.c.~1.154.~ 2009-01-28 15:14:18.000000000 +0900 --- fontset.c 2009-01-28 15:50:37.000000000 +0900 *************** *** 470,476 **** return font_group; base_fontset = FONTSET_BASE (fontset); if (c >= 0) ! font_group = char_table_ref_and_range (base_fontset, c, &from, &to); else font_group = FONTSET_FALLBACK (base_fontset); if (NILP (font_group)) --- 470,480 ---- return font_group; base_fontset = FONTSET_BASE (fontset); if (c >= 0) ! { ! font_group = char_table_ref (base_fontset, c); ! if (! NILP (font_group)) ! font_group = char_table_ref_and_range (base_fontset, c, &from, &to); ! } else font_group = FONTSET_FALLBACK (base_fontset); if (NILP (font_group)) >>> 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. > But FT_Get_Char_Index is much slower than FcCharSetHasChar. > `tt_cmap4_char_map_binary' in the above table is called from > FT_Get_Char_Index. Hmmm. I've just found that Xft has the function XftCharExists now. I remember that it didn't exist in a rather old vesion. Does your Xft library have this function? --- Kenichi Handa handa@m17n.org