Cache heights-for-range-of-widths instead of height for every width.

This patch optimizes window resizes by assuming that if a widget
has the same height at a width of 50 as with a width of 150, the
height for width 100 will also be the same.

The patch also further optimizes the cache allocator, now there
are 2 pointer arrays of up to a maximum of 5 requests, the arrays
will only be allocated if a request is ever made in that orientation
and the array will be sparse until each request is made (i.e. if a
label can only wrap to 3 lines, there will only be 3 out of a
possible 5 SizeRequest structures allocated to cache it).
This commit is contained in:
Tristan Van Berkom
2011-03-06 15:13:56 +09:00
parent 82ae7b77ca
commit 38b5c8cf45
3 changed files with 284 additions and 212 deletions

View File

@ -10669,8 +10669,7 @@ gtk_widget_finalize (GObject *object)
if (priv->context)
g_object_unref (priv->context);
if (priv->requests.sizes)
g_slice_free (ContextualSizes, priv->requests.sizes);
_gtk_widget_free_cached_sizes (widget);
if (g_object_is_floating (object))
g_warning ("A floating object was finalized. This means that someone\n"