registry: expensive plugin metadata loading
The plugin metadata is known to be a structure of strings, but we go through the expensive gst_structure_to_string
/gst_structure_from_string
as a storage format.
gst_structure_from_string()
represents over 36% (in callgrind instruction calls) of reading the registry cache.
It would be more efficient to just use a simple/custom binary format to store/create those structures:
- byte with number of elements (to directly call gst_structure_new_empty())
- for each entry:
- For the name, either:
- '0' byte followed by one byte for GST_ELEMENT_METADATA_* (allows directly using quark for setting the value)
- '1' byte followed by 4 bytes for the length of the custom name, followed by the NULL-terminated string for the name
- 4 bytes with length of value (so we know how much follows)
- string null terminated
- For the name, either: