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 689182 - [pitivi] Making a frei0r ElementFactory does a lot of I/O and slows down startup
[pitivi] Making a frei0r ElementFactory does a lot of I/O and slows down startup
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.0.2
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-11-27 20:24 UTC by Jean-François Fortin Tam
Modified: 2012-11-28 16:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test script (1.21 KB, application/octet-stream)
2012-11-27 20:24 UTC, Jean-François Fortin Tam
Details
GST_DEBUG=6 bin/pitivi 2>&1 |grep factory_make (8.19 KB, application/octet-stream)
2012-11-27 20:26 UTC, Jean-François Fortin Tam
Details
GST_DEBUG=*FACTORY*:6 bin/pitivi 2>&1 |grep 'factory_make\|gst_element_factory_create.*Created' (8.19 KB, application/octet-stream)
2012-11-27 20:26 UTC, Jean-François Fortin Tam
Details

Description Jean-François Fortin Tam 2012-11-27 20:24:36 UTC
Created attachment 230035 [details]
test script

In pitivi, I need to check for the presence of at least one particular frei0r plugin. The problem is that on a cold start, this takes 3 seconds on an average computer (without an SSD), which multiplies the application startup time by 2 or 3 times.

Attached is a very simple script that demonstrates the problem. frei0r is affected when creating an ElementFactory, but libav is not.

# sync && echo 3 > /proc/sys/vm/drop_caches

$ python bench_plugins_loading.py 
gst init took 0.411 secs
	making a sandwich: 0.431 secs
	making another sandwich: 0.000 secs
	frei0r (reg): 0.003 secs
	libav (reg): 0.000 secs
	frei0r (factory): 2.195 secs   <-----------
	libav (factory): 0.121 secs
Soft deps check done in 2.752 seconds
Comment 1 Jean-François Fortin Tam 2012-11-27 20:26:05 UTC
Created attachment 230036 [details]
GST_DEBUG=6 bin/pitivi 2>&1 |grep factory_make
Comment 2 Jean-François Fortin Tam 2012-11-27 20:26:59 UTC
Created attachment 230037 [details]
GST_DEBUG=*FACTORY*:6 bin/pitivi 2>&1 |grep 'factory_make\|gst_element_factory_create.*Created'
Comment 3 Tim-Philipp Müller 2012-11-27 23:38:35 UTC
What does this show:

 $ ls -1 /usr/lib/frei0r-1/*so | wc -l

It's not entirely surprising that it takes some time, since it needs to dlopen all those frei0r plugins. It's different for libav, there are no plugins involved there.

> # With factory makes, used for checking for the availability of specific features
> if Gst.ElementFactory.make("frei0r-filter-scale0tilt", None) is None:
>    pass

There's no need to create an element (and force loading of the gstreamer plugin and all wrapped plugins) to test the availability of a specific feature.

Use something like

 registry = gst.registry_get()
 if registry.lookup_feature('frei0r-filter-scale0tilt'):
   pass

or:

 registry = gst.registry_get()
 if registry.check_feature_version ('frei0r-filter-scale0tilt', 1, 0, 0):
   pass

Looks like NOTABUG to me.
Comment 4 Jean-François Fortin Tam 2012-11-28 16:18:50 UTC
Yeah, the frei0r folder has 108 elements.

You are correct that using registry.lookup_feature or check_feature_version takes only 100 milliseconds on a cold start, instead of the ~2-3 seconds required to make the ElementFactory, so this is a PEBKAC.