Bug 474564

Summary: Inserting and removing time operations are very slow in a long project
Product: [Applications] kdenlive Reporter: jackleberry
Component: User Interface & MiscellaneousAssignee: Jean-Baptiste Mardelle <jb>
Status: REPORTED ---    
Severity: minor    
Priority: NOR    
Version First Reported In: 23.08.0   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description jackleberry 2023-09-15 17:44:00 UTC
SUMMARY

Inserting and removing time operations are very slow in a large project. The project is about 5 hours long with many, many small clips. Inserting or removing time near the beginning takes several minutes to complete, with no feedback in the interface that any work is being done (such as the progress indicator seen when analyzing audio).

Probably much unnecessary work (maybe triggering redraws or similar) is being done for each clip whose offset is being adjusted, as the delay is proportional to the number of clips after the playhead.

STEPS TO REPRODUCE
1.  Have a very long project
2.  Insert or remove time near the beginning

OBSERVED RESULT

Takes an unreasonable amount of time

EXPECTED RESULT

Works instantly.

ADDITIONAL INFORMATION

None
Comment 1 jackleberry 2023-09-17 00:12:48 UTC
Console output during the delay consists of lots of entries like this (about 1 to 3 seconds between each):

warp LENGTH 493
Reusing timewarp producer!
warp LENGTH 360
Reusing timewarp producer!
warp LENGTH 360

And this at the end when the program becomes responsive again:

:::: DURATION FOR TIMELINE MODE: 540039  =  540015
::: UPDATING MAIN TIMELINE DURATION:  540039

I've also noticed that Insert Time (all tracks) sometimes (randomly?) inserts the time before the beginning of the clip to the left of the playhead, rather than where the playhead is located (which is at the joint between two clips).