Commit 275df09c authored by Ell's avatar Ell

buffer: in cache, replace global tile queue with per-instance queues

Currently, we maintain a global queue of tiles, ordered by access
time, from most-recent to least-recent.  This requires us to
acquire a global mutex whenever accessing/inserting a tile, in order
to maintain the queue.

The commit replaces the global tile queue with per-instance tile
queues, ordered by the same criterion, which allows us to avoid
acquiring the global cache mutex in the above cases.  The global
mutex mainly has to be acquired only during cache construction,
destruction, and trimming.

To keep trimming simple, and relatively efficient, this commit
changes the cache eviction strategy: instead of evicting the least-
recently accessed tile first, we evict the least-recently accessed
tile of the least-recently accessed cache first (which might not be
the least-recently accessed tile overall).
parent 12056e75
This diff is collapsed.
......@@ -40,8 +40,11 @@ struct _GeglTileHandlerCache
{
GeglTileHandler parent_instance;
GeglTileStorage *tile_storage;
GList link;
GHashTable *items;
int count; /* number of items held by cache */
GQueue queue;
guintptr time;
guintptr stamp;
};
struct _GeglTileHandlerCacheClass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment