attributes: avoid g_strdup in cogl_attribute_new

Calling g_strdup for attribute names was starting to show up in profiles
due to calling malloc for new string storage so frequently. This avoids
calling g_strdup and calls g_intern_string() instead. For the really
common case names we even avoid the cost of g_intern_string since we
can trivially relate our internal name_id to a static string.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg
2011-09-19 02:31:41 +01:00
parent 4c3dadd35e
commit 791773987c
2 changed files with 42 additions and 8 deletions

View File

@ -45,7 +45,7 @@ struct _CoglAttribute
CoglObject _parent;
CoglAttributeBuffer *attribute_buffer;
char *name;
const char *name;
CoglAttributeNameID name_id;
gsize stride;
gsize offset;