[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reducing equality tests in displaying text
From: |
YAMAMOTO Mitsuharu |
Subject: |
Re: reducing equality tests in displaying text |
Date: |
Wed, 28 Jan 2009 09:12:40 +0900 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) |
>>>>> On Tue, 27 Jan 2009 14:26:42 +0900, Kenichi Handa <address@hidden> 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.
>> 2. Also in fontset.c:
>> 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?
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
53.5 ms emacs x_produce_glyphs
49.4 ms emacs fontset_find_font
36.3 ms emacs char_table_ref
31.3 ms libXft.2.dylib XftGlyphExtents
31.2 ms emacs get_next_display_element
29.2 ms emacs face_for_char
28.4 ms emacs display_count_lines
28.4 ms mach_kernel ml_set_interrupts_enabled
28.2 ms emacs hash_lookup
24.2 ms emacs assq_no_quit
24.2 ms emacs sub_char_table_ref
23.3 ms emacs validate_interval_range
23.2 ms emacs sort_overlays
22.3 ms libXft.2.dylib XftFontCheckGlyph
22.2 ms emacs move_it_in_display_line_to
21.3 ms emacs xftfont_text_extents
20.3 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.
YAMAMOTO Mitsuharu
address@hidden
- reducing equality tests in displaying text, YAMAMOTO Mitsuharu, 2009/01/22
- Re: reducing equality tests in displaying text, Kenichi Handa, 2009/01/27
- Re: reducing equality tests in displaying text,
YAMAMOTO Mitsuharu <=
- Re: reducing equality tests in displaying text, Kenichi Handa, 2009/01/28
- Re: reducing equality tests in displaying text, YAMAMOTO Mitsuharu, 2009/01/28
- Re: reducing equality tests in displaying text, Kenichi Handa, 2009/01/28
- Re: reducing equality tests in displaying text, YAMAMOTO Mitsuharu, 2009/01/28
- Re: reducing equality tests in displaying text, Kenichi Handa, 2009/01/28
- Re: reducing equality tests in displaying text, Jason Rumney, 2009/01/28
- Re: reducing equality tests in displaying text, Kenichi Handa, 2009/01/28