After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 350432 - micro-optimising quarks
micro-optimising quarks
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.10
Assigned To: Jan Schmidt
GStreamer Maintainers
Depends on:
Reported: 2006-08-08 13:45 UTC by Jan Schmidt
Modified: 2006-08-16 11:48 UTC
See Also:
GNOME target: ---
GNOME version: ---

pre-register quarks from static strings and use them in GstQuery (16.30 KB, patch)
2006-08-08 13:45 UTC, Jan Schmidt
reviewed Details | Review

Description Jan Schmidt 2006-08-08 13:45:14 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.
Comment 1 Jan Schmidt 2006-08-08 13:45:52 UTC
Created attachment 70484 [details] [review]
pre-register quarks from static strings and use them in GstQuery
Comment 2 Wim Taymans 2006-08-09 11:16:11 UTC
the _priv_ prefix seems weird, I don't think we name private symbols like that anywhere else (__gst or so). 
Comment 3 Jan Schmidt 2006-08-09 11:19:00 UTC
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.
Comment 4 Jan Schmidt 2006-08-16 11:48:55 UTC
        * docs/gst/gstreamer-sections.txt:
        * gst/
        * 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.