GNOME Bugzilla – Bug 350432
micro-optimising quarks
Last modified: 2006-08-16 11:48:55 UTC
Attaching a patch which adds a new non-installed header gstquark.h, and some new private data that allows us to pre-register some static strings with g_quark_from_static_string and save looking up quarks when inserting values into GstStructures. As a first place to use it, all the structure accesses in GstQuery now go straight from stored quarks. The same can be done for events, and the same technique could be used in helper functions in libgstvideo/audio to avoid Quark lookups. It's a small optimisation, but it made a degenerate test case of create-each-query,parse-each-query about 10 times faster.
Created attachment 70484 [details] [review] pre-register quarks from static strings and use them in GstQuery
the _priv_ prefix seems weird, I don't think we name private symbols like that anywhere else (__gst or so).
I'm planning to change those others at some point too - at the moment we export a several __gst symbols that we shouldn't, just because they match our export regexp of 'anything starting with [_]*gst' - there are some _gst symbols we should export (_gst_debug_min for example), and some we should not.
* docs/gst/gstreamer-sections.txt: * gst/Makefile.am: * gst/gst.c: (init_post): * gst/gst_private.h: * gst/gstquark.c: (_priv_gst_quarks_initialize): * gst/gstquark.h: * gst/gstquery.c: (gst_query_new_position), (gst_query_set_position), (gst_query_parse_position), (gst_query_new_duration), (gst_query_set_duration), (gst_query_parse_duration), (gst_query_new_convert), (gst_query_set_convert), (gst_query_parse_convert), (gst_query_new_segment), (gst_query_set_segment), (gst_query_parse_segment), (gst_query_new_seeking), (gst_query_set_seeking), (gst_query_parse_seeking): Add internal helpers for pre-registering quarks from static strings and using the quark values directly instead of looking them up when creating and parsing queries. Can be used for event construction too. Closes #350432.