Zulko / moviepy

Video editing with Python
https://zulko.github.io/moviepy/
MIT License
12.07k stars 1.51k forks source link

Certain decorators perform extremely slow function inspection every call #2094

Open bzczb opened 5 months ago

bzczb commented 5 months ago

In decorators.py, preprocess_args() and use_clip_fps_by_default() do function inspection on their decorated function every time the wrapped function is called. This causes extreme performance issues. On my system a large majority of the time rendering audio, something like 70% or 80%, is spent runninginspect.getfullargspec() on the same functions.

Expected Behavior

The decorators only compute their wrapped function's arguments once.

Actual Behavior

The decorators compute their wrapped function's arguments every time the wrapped function is called.

Steps to Reproduce the Problem

In a Python debugger, render anything in MoviePy. Set a breakpoint inside the decorator wrappers and observe.

Specifications