Cost of string fields in caps
Using strings in caps values introduce the following overhead:
- strdup for copying the value
- strcmp for comparing the values
- temporary memory copies (because of strdup) everywhere
Furthermore, those string values will be somewhat limited (they are well-known types).
It would be worthwile to investigate using "interned" strings for the
G_TYPE_STRING values in the
GstCaps. This can be done by using
g_value_set_static_string() which will internally avoid copies and allow fast string comparision.
This could be done by having a "private"
gstvalue.c for those strings (instead of clashing with the global GQuark hashtable).
This might introduce a small memory increase (because of the hashtable) but which should mitigate the overall memory usage of string copies everywhere.
Note that this should only be done for caps structures. Other usages don't imply uniqueness of string values.