unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
To: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Cc: emacs-devel@gnu.org
Subject: Re: reducing equality tests in displaying text
Date: Wed, 28 Jan 2009 16:03:01 +0900	[thread overview]
Message-ID: <E1LS4Rx-0000hD-GW@etlken> (raw)
In-Reply-To: <wlpri8l24n.wl%mituharu@math.s.chiba-u.ac.jp> (message from YAMAMOTO Mitsuharu on Wed, 28 Jan 2009 09:12:40 +0900)

In article <wlpri8l24n.wl%mituharu@math.s.chiba-u.ac.jp>, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

>>>>>> On Tue, 27 Jan 2009 14:26:42 +0900, Kenichi Handa <handa@m17n.org> 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




  reply	other threads:[~2009-01-28  7:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-23  2:23 reducing equality tests in displaying text YAMAMOTO Mitsuharu
2009-01-27  5:26 ` Kenichi Handa
2009-01-28  0:12   ` YAMAMOTO Mitsuharu
2009-01-28  7:03     ` Kenichi Handa [this message]
2009-01-28  9:11       ` YAMAMOTO Mitsuharu
2009-01-29  0:37         ` Kenichi Handa
2009-01-29  1:46           ` YAMAMOTO Mitsuharu
2009-01-29  2:29             ` Kenichi Handa
2009-01-29  2:38               ` Jason Rumney
2009-01-29  2:46                 ` Kenichi Handa
2009-02-21  6:08             ` YAMAMOTO Mitsuharu
2009-02-24 11:58               ` Kenichi Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1LS4Rx-0000hD-GW@etlken \
    --to=handa@m17n.org \
    --cc=emacs-devel@gnu.org \
    --cc=mituharu@math.s.chiba-u.ac.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).