Commit eae6e51f authored by Daniel Sabo's avatar Daniel Sabo

BackendSwap: Avoid allocation in get_tile

Allocating the key on the stack makes the performance identical
to backend ram when nothing has been swapped.
parent 49693771
......@@ -574,13 +574,9 @@ gegl_tile_backend_swap_lookup_entry (GeglTileBackendSwap *self,
gint y,
gint z)
{
SwapEntry *ret = NULL;
SwapEntry *key = gegl_tile_backend_swap_entry_create (x, y, z);
SwapEntry key = {0, NULL, x, y, z};
ret = g_hash_table_lookup (self->index, key);
g_slice_free (SwapEntry, key);
return ret;
return g_hash_table_lookup (self->index, &key);
}
static GeglTile *
......@@ -589,14 +585,12 @@ gegl_tile_backend_swap_get_tile (GeglTileSource *self,
gint y,
gint z)
{
GeglTileBackend *backend;
GeglTileBackendSwap *tile_backend_swap;
SwapEntry *entry;
GeglTile *tile = NULL;
gint tile_size;
backend = GEGL_TILE_BACKEND (self);
tile_backend_swap = GEGL_TILE_BACKEND_SWAP (backend);
tile_backend_swap = GEGL_TILE_BACKEND_SWAP (self);
entry = gegl_tile_backend_swap_lookup_entry (tile_backend_swap, x, y, z);
if (!entry)
......@@ -763,8 +757,6 @@ gegl_tile_backend_swap_constructed (GObject *object)
G_OBJECT_CLASS (parent_class)->constructed (object);
backend->priv->shared = FALSE;
gegl_tile_backend_set_flush_on_destroy (backend, FALSE);
GEGL_NOTE (GEGL_DEBUG_TILE_BACKEND, "constructing swap backend");
......
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