Created attachment 123823 [details] callgrind output from when trying to use the time slicing tool with SUMMARY When trying to use the spacer tool to close gaps in the video where I've cut pieces out and rearranged, STEPS TO REPRODUCE 1. Have video with many clips in the timeline, cut it up and have lots of gaps (I'm talking about 50+ little segments) 2. Use the spacer tool to try and close the gaps where there are many clips to the right OBSERVED RESULT Program hangs for approximately 10 seconds before clips jump to their new position. EXPECTED RESULT Clips should move much more quickly. <100ms ideally, maybe <1s minimally. System info: CPU: Intel Core i7-5820K @ 3.3GHz, 12-core Memory: 48 GiB OS: Ubuntu 19.10 eoan 64-bit I've run just that operation with the valgrind tool callgrind and generated profiling information. I was clicking around in it, but couldn't really work it out. It looks maybe like it's an MLT problem with just moving lots of clips... ?
Created attachment 123828 [details] another callgrind output - with debug 6.17.0 MLT this time.
So it looks like just shuffling along these clips they are being removed and then reinserted. It appears that Mlt::Playlist::insert_at->mlt_playlist_insert_at is called 360 times and this causes 2,800,000+ calls to mlt_playlist_virtual_refresh and 28,000,000+ calls to mlt_properties_get_data which is where most of the freeze happens. This is making kdenlive unusable for me :( Is it possible to get a version of that timeline-shuffling spacer tool that just changes the start/end properties of the clips instead of removing/re-adding them, because it seems to be very expensive in MLT. Thanks
Thank you for this analysis. This is very helpful. Do you experience other steps which creates similar amount of calls?
Thanks for the great input, hopefully this can be fixed for 21.04. Also tracked here: https://invent.kde.org/multimedia/kdenlive/-/issues/963
@Bill In the meantime we made some performance improvements. Please test with the actual master.
@bill do you think you can compile and test this commit: https://invent.kde.org/multimedia/kdenlive/-/merge_requests/216
Thanks! I will have a go at it next week. It's on my list! :)
Created attachment 141429 [details] callgrind output using spacer tool on big project I updated to the latest master and also I have tried the sandsmark/martin/texture-cache branch. Both are still about as slow using the spacer tool. I have recorded another doing one move with the spacer tool of a big project with lots of edits. You can uncompress it and then open it with kcachegrind, maybe it's useful. I will also attach the project file
Created attachment 141430 [details] large project file causing spacer tool to be slow Please find attached the compressed project file that causes the spacer tool to be really slow for me. I can't attach the clips as they're from a personal family project. Thanks
*** Bug 441662 has been marked as a duplicate of this bug. ***
This should be fixed with https://invent.kde.org/multimedia/kdenlive/-/commit/609278fdfdf3fcb942d2a0812354ffcbb4fce064 and https://invent.kde.org/multimedia/kdenlive/-/commit/19600e4c0e8e34f00f67eaf3e5834a38eb685887 Could you test the master branch and let us know?