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 684006 - Make gstreamermm initialize faster
Make gstreamermm initialize faster
Status: RESOLVED FIXED
Product: gstreamermm
Classification: Bindings
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gstreamermm-maint
gstreamermm-maint
Depends on:
Blocks:
 
 
Reported: 2012-09-14 06:13 UTC by José Alburquerque
Modified: 2012-09-17 20:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gstreamermm patch to speed up initialization. (4.27 KB, patch)
2012-09-14 06:18 UTC, José Alburquerque
none Details | Review
glibmm patch to modify generate_wrap_init.pl to allow classes in files to not be registered. (5.33 KB, patch)
2012-09-14 06:22 UTC, José Alburquerque
none Details | Review
glibmm patch to modify generate_wrap_init.pl to allow classes in files to not be registered. (5.52 KB, patch)
2012-09-14 20:52 UTC, José Alburquerque
committed Details | Review
glibmm patch to allow _CLASS_GOBJECT classes to have custom Glib::wrap() functions. (3.14 KB, patch)
2012-09-14 20:53 UTC, José Alburquerque
committed Details | Review
gstreamermm patch to speed up initialization. (6.84 KB, patch)
2012-09-14 20:54 UTC, José Alburquerque
none Details | Review
gstreamermm patch to speed up initialization. (6.83 KB, patch)
2012-09-14 22:37 UTC, José Alburquerque
committed Details | Review

Description José Alburquerque 2012-09-14 06:13:26 UTC
Hi.  In an e-mail discussion[1] on the GStreaer-devel list, the speed of initialization of the gstreamermm library was discussed and I discovered that it's most probably due to the fact that Gst::init() loads all the plug-ins that are wrapped to get their GTypes and then register their wrap_new() functions.

[1] 

Since it is not possible to get any plug-in types from C code I think it's safe to remove the registration of the wrap_new() functions because these would be used only if a C type was created with the C API and someone tried to wrap it using a Glib::wrap() method and creating a plug-in type is just not possible with the C API.

The patch to follow modifies gstreamermm so that Gst::wrap_init() does not register a wrap_new() function for plug-ins, thus reducing initialization significantly because the plug-ins are not pre-loaded but instead loaded when one is created.  The patch relies on another patch which modifies glibmm's generate_wrap_init.pl script.  That patch will also be attached.

I think this will make gstreamermm faster to initialize, thus better for those that need a fast loading library.
Comment 1 José Alburquerque 2012-09-14 06:15:32 UTC
Here's the discussion link:

[1] http://lists.freedesktop.org/archives/gstreamer-devel/2012-September/037199.html
Comment 2 José Alburquerque 2012-09-14 06:18:19 UTC
Created attachment 224301 [details] [review]
gstreamermm patch to speed up initialization.
Comment 3 José Alburquerque 2012-09-14 06:22:30 UTC
Created attachment 224302 [details] [review]
glibmm patch to modify generate_wrap_init.pl to allow classes in files to not be registered.
Comment 4 José Alburquerque 2012-09-14 20:51:40 UTC
Actually, there's a way for the plug-in types to not be registered in the wrap_init() function but then be registered later both when a new C++ of the plug-in is created and just before trying to wrap a C type of the plug-in should one be attained somehow.  This would reduce startup up time and keep the wrapping system working as if the plug-in types had been registered.  The updated patches will follow.
Comment 5 José Alburquerque 2012-09-14 20:52:38 UTC
Created attachment 224359 [details] [review]
glibmm patch to modify generate_wrap_init.pl to allow classes in files to not be registered.
Comment 6 José Alburquerque 2012-09-14 20:53:54 UTC
Created attachment 224360 [details] [review]
glibmm patch to allow _CLASS_GOBJECT classes to have custom Glib::wrap() functions.
Comment 7 José Alburquerque 2012-09-14 20:54:37 UTC
Created attachment 224361 [details] [review]
gstreamermm patch to speed up initialization.
Comment 8 José Alburquerque 2012-09-14 22:37:40 UTC
Created attachment 224371 [details] [review]
gstreamermm patch to speed up initialization.

Updated because the custom Glib::wrap() functions of the plug-ins should call the plug-in *_get_type() functions which already do the registration and not use Glib::wrap_register() directly because it may cause the type to be registered more than once (when a C++ object is created and if the Glib::wrap() function is called).