GNOME Bugzilla – Bug 689182
[pitivi] Making a frei0r ElementFactory does a lot of I/O and slows down startup
Last modified: 2012-11-28 16:18:50 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
Created attachment 230036 [details] GST_DEBUG=6 bin/pitivi 2>&1 |grep factory_make
Created attachment 230037 [details] GST_DEBUG=*FACTORY*:6 bin/pitivi 2>&1 |grep 'factory_make\|gst_element_factory_create.*Created'
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.
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.