[gtk+/wip/chergert/quartz-frame-clock: 227/228] gdk: micro optimization during process updates



commit a1358b575b155e7dbe5215905b621472b51a5080
Author: Christian Hergert <christian hergert me>
Date:   Fri Sep 11 15:51:21 2015 -0700

    gdk: micro optimization during process updates
    
    Rather than iterate the list multiple times, try to perform references
    while we build the array of items.
    
    This showed up on some micro benchmarks while working on quartz
    performance. There is most definitely more important things to fix, but
    this is low hanging fruit.

 gdk/gdkwindow.c |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 89ed898..9c1d3ae 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -2195,9 +2195,9 @@ gdk_window_get_window_type (GdkWindow *window)
 /**
  * gdk_window_get_visual:
  * @window: a #GdkWindow
- * 
+ *
  * Gets the #GdkVisual describing the pixel format of @window.
- * 
+ *
  * Returns: (transfer none): a #GdkVisual
  *
  * Since: 2.24
@@ -2206,16 +2206,16 @@ GdkVisual*
 gdk_window_get_visual (GdkWindow *window)
 {
   g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
-  
+
   return window->visual;
 }
 
 /**
  * gdk_window_get_screen:
  * @window: a #GdkWindow
- * 
+ *
  * Gets the #GdkScreen associated with a #GdkWindow.
- * 
+ *
  * Returns: (transfer none): the #GdkScreen associated with @window
  *
  * Since: 2.24
@@ -2231,9 +2231,9 @@ gdk_window_get_screen (GdkWindow *window)
 /**
  * gdk_window_get_display:
  * @window: a #GdkWindow
- * 
+ *
  * Gets the #GdkDisplay associated with a #GdkWindow.
- * 
+ *
  * Returns: (transfer none): the #GdkDisplay associated with @window
  *
  * Since: 2.24
@@ -3198,13 +3198,13 @@ gdk_window_flush (GdkWindow *window)
 /**
  * gdk_window_get_clip_region:
  * @window: a #GdkWindow
- * 
+ *
  * Computes the region of a window that potentially can be written
  * to by drawing primitives. This region may not take into account
  * other factors such as if the window is obscured by other windows,
  * but no area outside of this region will be affected by drawing
  * primitives.
- * 
+ *
  * Returns: a #cairo_region_t. This must be freed with cairo_region_destroy()
  *          when you are done.
  **/
@@ -3226,12 +3226,12 @@ gdk_window_get_clip_region (GdkWindow *window)
 /**
  * gdk_window_get_visible_region:
  * @window: a #GdkWindow
- * 
+ *
  * Computes the region of the @window that is potentially visible.
  * This does not necessarily take into account if the window is
  * obscured by other windows, but no area outside of this region
  * is visible.
- * 
+ *
  * Returns: a #cairo_region_t. This must be freed with cairo_region_destroy()
  *          when you are done.
  **/
@@ -3326,7 +3326,7 @@ _gdk_window_ref_cairo_surface (GdkWindow *window)
 /**
  * gdk_cairo_create:
  * @window: a #GdkWindow
- * 
+ *
  * Creates a Cairo context for drawing to @window.
  *
  * Note that calling cairo_reset_clip() on the resulting #cairo_t will
@@ -3334,7 +3334,7 @@ _gdk_window_ref_cairo_surface (GdkWindow *window)
  *
  * Returns: A newly created Cairo context. Free with
  *  cairo_destroy() when you are done drawing.
- * 
+ *
  * Since: 2.8
  **/
 cairo_t *
@@ -3605,7 +3605,7 @@ _gdk_window_process_updates_recurse_helper (GdkWindow *window,
   /* Iterate over children, starting at bottommost */
   for (l = last_link; l != NULL; l = l->prev)
     {
-      child = l->data;
+      child = g_ptr_array_index (children, i - 1);
 
       if (child->destroyed || !GDK_WINDOW_IS_MAPPED (child) || child->input_only || child->composited)
         continue;
@@ -4151,7 +4151,7 @@ gdk_window_invalidate_maybe_recurse_full (GdkWindow            *window,
   if (gdk_display_get_debug_updates (display))
     draw_ugly_color (window, visible_region, 0);
 
-  while (window != NULL && 
+  while (window != NULL &&
         !cairo_region_is_empty (visible_region))
     {
       if (window->invalidate_handler)
@@ -6471,7 +6471,7 @@ gdk_window_get_root_coords (GdkWindow *window,
       *root_y = 0;
       return;
     }
-  
+
   impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
   impl_class->get_root_coords (window->impl_window,
                               x + window->abs_x,
@@ -7522,7 +7522,7 @@ gdk_window_beep (GdkWindow *window)
       if (GDK_WINDOW_IMPL_GET_CLASS (toplevel->impl)->beep (toplevel))
         return;
     }
-  
+
   /* If windows fail to beep, we beep the display. */
   gdk_display_beep (display);
 }
@@ -10876,7 +10876,7 @@ gdk_window_configure_finished (GdkWindow *window)
  *
  * Set @window to render as partially transparent,
  * with opacity 0 being fully transparent and 1 fully opaque. (Values
- * of the opacity parameter are clamped to the [0,1] range.) 
+ * of the opacity parameter are clamped to the [0,1] range.)
  *
  * For toplevel windows this depends on support from the windowing system
  * that may not always be there. For instance, On X11, this works only on


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