text: Increase the size of the Layout cache

Currently, each ClutterText caches 3 Pango layouts:

  » one for the preferred, unbounded width
  » one for the preferred height for a given width
  » one for the allocated size

Some layout managers do a double pass that could flush the whole cache
before it has a chance of actually storing relevant data, resulting in
a continuous series of misses.

We can try to counteract this by doubling the size of the cache, from
three slots to six. More than six would be pointless, as well as too
memory consuming; but we might get down to a number between 3 and 6 at
any later point.
This commit is contained in:
Emmanuele Bassi 2010-04-16 11:11:50 +01:00
parent dd407326fe
commit 1a1e7d3573

View File

@ -66,8 +66,11 @@
* the preferred width to get the preferred height and then it might * the preferred width to get the preferred height and then it might
* be regenerated at a different width to get the height for the * be regenerated at a different width to get the height for the
* actual allocated width * actual allocated width
*
* since we might get multiple queries from layout managers doing a
* double-pass allocations, like tabular ones, we should use 6 slots
*/ */
#define N_CACHED_LAYOUTS 3 #define N_CACHED_LAYOUTS 6
#define CLUTTER_TEXT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_TEXT, ClutterTextPrivate)) #define CLUTTER_TEXT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_TEXT, ClutterTextPrivate))