Scintilla GTK2 profiling results



Sorry for the cross-post, but I though it might be helpful is the issues
are discussed with feedback from both Neil as well as GTK2 developers.

Scintilla GTK2 version with Pango seems quite a bit slower than the
plain GTK1 counterpart. So I did a quick profiling using KCachegrind to
identify the bottlenecks. The test case was to fire SciTE with a C++
source file as parameter and ensure that the file is fully loaded and
displayed with styling. The application was then closed immediately.

Platform: RedHat 8.0 + XFree86 4.3 (build from CVS source) + GNOME 2.2
(built from jhbuild) + CVS scintilla + scite

Hardware: Intel Pentium IV 2 GHz w/ 512 MB RAM , Intel i845G inbuilt
graphics card.

Scintilla compiled with GTK2=1 DEBUG=1. Pango use was forced by editing
PlatGTK.cxx. The source file used was anjuta/src/aneditor.cxx from GNOME
CVS (3356 lines, 103556 characters).


Results:
---------

The detailed cachegrind alanysis output can be found here:

http://anjuta.sf.net/biswapesh/cachegrind.out.19620.gz

For visualization, it would be of enormous help if you install Valgrind
[1] and KCachegrind[2]. Both are i386 LInux only programs. KCachegrind
needs KDE 3.x.

Time spent by ELF object (Self):
	gobject		22.2%
	fontconfig	12.7%
	glib		11.4%
	pango		8.8%
	valgrind	8.1%
	SciTE		7.5%

By time taken in function (Self):
	g_type_check_instance_is_a		9.1%
	XftGlyghExtents				4.9%
	g_datalist_id_get_data			4.4%
	g_object_get_qdata			3.69%
	pango_xft_font_get_glyph_extents	2.9%
	FcStrCmpIgnoreCase			2.4%
	pango_glyph_strings_extents_range	2.4%

By time taken in function (Cumulative):
	pango_fc_font_map_load_fontset		17.9%
	pango_fc_font_map_get_patterns		17.6%
	pango_font_get_glyph_extents		15.9%
	pango_xft_font_get_glyph_extents	15.9%
	gtk_item_factory_get_widget_by_action	14.2%
	g_object_get_qdata			13.3%
	pango_glyph_string_extents		12.5%
	pango_glyph_string_extents_range	12.5%
	pango_layout_run_get_extents		12.3%

By function (number of calls)
	g_type_check_instance_is_a		492,823
	g_datalist_id_get_data			325,652
	g_object_get_qdata			318,548
	strcmp					210,108
	xft_font_get_font			153,828
	XftFontCheckGlyph			150,282
	_pango_xft_font_map_get_info		149,060
	pango_font_get_glyph_extents		148,985
	pango_xft_font_get_glyph_extents	148,985
	XftGlyphExtents				148,985
	FcStrCmpIgnoreCase			132,696
	strchr					131,476
	FcDebug					128.740
	__getc_unlocked				113,198
	g_type_value_table_peek			105,410


Conclusions:

1. We seem to be spending way too much time in:
	a) The object system
	b) Pango font query functions

So, if there a way to improve on the current situation ?

[1] Valgrind: http://developer.kde.org/~sewardj/
[2] KCacheGrind: http://kcachegrind.sourceforge.net/


Thanks and regards,
-- 
Biswa.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]