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: Re: reducing equality tests in displaying text Date: Wed, 28 Jan 2009 18:11:31 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: 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 1233133925 11654 80.91.229.12 (28 Jan 2009 09:12:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Jan 2009 09:12:05 +0000 (UTC) Cc: emacs-devel@gnu.org To: Kenichi Handa Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 28 10:13:19 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 1LS6To-0007YX-SK for ged-emacs-devel@m.gmane.org; Wed, 28 Jan 2009 10:13:05 +0100 Original-Received: from localhost ([127.0.0.1]:52107 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LS6SW-0007LF-Gp for ged-emacs-devel@m.gmane.org; Wed, 28 Jan 2009 04:11:44 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LS6SQ-0007L6-MD for emacs-devel@gnu.org; Wed, 28 Jan 2009 04:11:39 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LS6SO-0007KR-LX for emacs-devel@gnu.org; Wed, 28 Jan 2009 04:11:38 -0500 Original-Received: from [199.232.76.173] (port=46296 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LS6SO-0007KH-GA for emacs-devel@gnu.org; Wed, 28 Jan 2009 04:11:36 -0500 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:50478) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LS6SN-0004YA-Q6 for emacs-devel@gnu.org; Wed, 28 Jan 2009 04:11:36 -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 E92992C5A; Wed, 28 Jan 2009 18:11:32 +0900 (JST) In-Reply-To: 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:108324 Archived-At: >>>>> On Wed, 28 Jan 2009 16:03:01 +0900, Kenichi Handa said: >> > 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? Here is the result. 750.9 ms emacs mark_object 153.4 ms libfreetype.6.dylib tt_cmap4_char_map_binary 126.7 ms emacs Fgarbage_collect 106.8 ms emacs mark_vectorlike 64.8 ms emacs x_produce_glyphs 61.5 ms emacs char_table_ref 47.5 ms emacs fontset_find_font 33.3 ms emacs get_next_display_element 30.3 ms emacs face_for_char 29.3 ms libXft.2.dylib XftGlyphExtents 29.3 ms emacs assq_no_quit 29.3 ms emacs find_interval 27.3 ms emacs hash_lookup 26.3 ms emacs make_uninit_multibyte_string 25.2 ms emacs sub_char_table_ref 24.4 ms mach_kernel ml_set_interrupts_enabled 23.2 ms emacs next_element_from_buffer 22.3 ms emacs display_count_lines 20.2 ms emacs Fcons 19.2 ms libXft.2.dylib XftCharIndex >>>> 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? It exists. But it simply uses the `charset' member in struct _XftFont: _X_EXPORT FcBool XftCharExists (Display *dpy, XftFont *pub, FcChar32 ucs4) { if (pub->charset) return FcCharSetHasChar (pub->charset, ucs4); return FcFalse; } Is there any reason you prefer an Xft-level routine to fontconfig-level? By adding some `FcCharSet *' member in struct ftfont as I said, you don't need to "override" `has_char' function in the xft driver, and the ftx driver can also benefit from it for free. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp