mark: use gslice for inferred rect

We can get a little boost by using the gslice allocator for the structs
of the same size.
This commit is contained in:
Christian Hergert
2018-05-17 19:42:10 +01:00
parent 23a0cebfe2
commit c734f59ba5

View File

@ -79,7 +79,7 @@ free_inferred_rect (InferredRect *rect)
{ {
g_free (rect->name); g_free (rect->name);
g_free (rect->message); g_free (rect->message);
g_free (rect); g_slice_free (InferredRect, rect);
} }
static void static void
@ -150,16 +150,12 @@ process_gpu_mark (BuildState *state,
} }
else else
{ {
rect = g_malloc0 (sizeof (*rect)); rect = g_slice_new0 (InferredRect);
if (!rect)
return FALSE;
rect->name = g_strdup (mark->name); rect->name = g_strdup (mark->name);
rect->message = g_strdup (mark->message); rect->message = g_strdup (mark->message);
rect->time = mark->frame.time; rect->time = mark->frame.time;
g_hash_table_insert (state->inferred_rects,
rect->message, g_hash_table_insert (state->inferred_rects, rect->message, rect);
rect);
} }
return TRUE; return TRUE;