- Podcasts
- Planet Python – The Open Sourcerer
- Improving project loading performance
Improving project loading performance
Planet Python – The Open Sourcerer
- November 24, 2010
About this episode
When you load a project in PiTiVi, importing the clips into the “media library” (also known internally as the “source list”) is pretty fast, but inserting them in the timeline is painfully slow. So I whipped out my torture test project and spent some time profiling what’s going on using Python’s cProfile module (I talked about it before, but see also this well-written page from the GTG folks).
The findings were interesting. Graphically, we end up with something like this:
Looking at where the time was spent, near the bottom of that graph, I suspected that linking was the root of the evil we saw.
Not long after I posted my findings, Edward posted an initial patch that makes it three times faster. Here are some measurements:
(Insertion times exclude the time to import clips to the source list)
As hinted by a new version of the profiling graph, there probably is more work left to do, but this patch at least makes things more bearable. A problem is that Python’s cProfile can’t really introspect what’s going on in the “add” method of gst.Bin… Also, if anyone feels like hacking on a nice little project to get familiar with PiTiVi, may I suggest better loading progress indication? 😉