gtk+ performance, especially as seen by the magnifier



GTK+ experts:

The accessibility team is working to improve the performance of the
GNOME magnifier, and we notice that a lot of time is spent in
various Xwindows functions that are called via GTK+.

1) The magnifier is spending over half of its time in XSync.  The
   magnifier makes calls to either gdk_window_invalidate_rect or
   gdk_window_scroll each time it updates the screen.  In either
   case, gdk_window_invalidate_region is called, which sets up an
   idle handler (gdk_window_update_idle) of priority
   GDK_PRIORITY_REDRAW.  The idle handler calls
   gdk_window_process_all_updates, which calls gdk_flush.  The
   XSync calls are all coming from this gdk_flush.

   Is it really necessary to call gdk_flush in all situations?
   It seems that GDK could be a bit smarter about only flushing
   when necessary, or allow programs to have more control when
   the flushing happens (or turn it off altogether - I suspect
   programs like the magnifier do not really need the flushing
   behavior to happen all the time - if at all).

2) Profiling the Xserver shows that it is spending about 18%
   of its time in X_CreateGC.  These calls are caused by the
   magnifier's calls to XCreateGC.  These calls are coming
   from the following GDK functions:

   Incl.     Excl.     Incl.     Excl.     Incl.    Excl.     Name
   User CPU  User CPU  Sys. CPU  Sys. CPU  Wall     Wall
   sec.      sec.     sec.      sec.        sec.     sec.
   0.740     0.060    0.710     0.          9.430    0.060   _gdk_x11_copy_to_image
   3.150     0.110    0.010     0.          3.520    0.110   _gdk_x11_gc_new
   0.650     0.070    0.        0.          0.650    0.070   gdk_window_copy_area_

   So, mostly from _gdk_x11_copy_to_image and _gdk_x11_gc_new.  Is
   there any reason why GDK needs to keep creating these?  Couldn't
   GDK simply cache and reuse them?  If so, this would drastically
   reduce the overall load that GDK places on the Xserver.

--

Brian




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