lagmoellertim / unsilence

Console Interface and Library to remove silent parts of a media file 🔈
https://unsilence.readthedocs.io/
MIT License
556 stars 45 forks source link

Performance improvements #141

Open Mte90 opened 2 years ago

Mte90 commented 2 years ago

Considering that the performance in this tool are important and depends to ffmpeg there are some ways to improve it.

https://pypi.org/project/perflint/ reported those things

************* Module unsilence.lib.render_media.MediaRenderer
unsilence/lib/render_media/MediaRenderer.py:122:12: W8205: Importing the "sleep" name directly is more efficient in this loop. (dotted-import-in-loop)
unsilence/lib/render_media/MediaRenderer.py:80:26: W8301: Use tuple instead of list for a non-mutated sequence (use-tuple-over-list)
unsilence/lib/render_media/MediaRenderer.py:81:30: W8301: Use tuple instead of list for a non-mutated sequence (use-tuple-over-list)
unsilence/lib/render_media/MediaRenderer.py:177:19: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/lib/render_media/MediaRenderer.py:177:19: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/lib/render_media/MediaRenderer.py:156:18: W8301: Use tuple instead of list for a non-mutated sequence (use-tuple-over-list)
************* Module unsilence.lib.intervals.Intervals
unsilence/lib/intervals/Intervals.py:15:28: W8301: Use tuple instead of list for a non-mutated sequence (use-tuple-over-list)
unsilence/lib/intervals/Intervals.py:83:38: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
************* Module unsilence.lib.detect_silence.DetectSilence
unsilence/lib/detect_silence/DetectSilence.py:53:22: W8205: Importing the "search" name directly is more efficient in this loop. (dotted-import-in-loop)
unsilence/lib/detect_silence/DetectSilence.py:76:22: W8205: Importing the "search" name directly is more efficient in this loop. (dotted-import-in-loop)
unsilence/lib/detect_silence/DetectSilence.py:61:15: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/lib/detect_silence/DetectSilence.py:81:29: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/lib/detect_silence/DetectSilence.py:81:29: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/lib/detect_silence/DetectSilence.py:81:29: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/lib/detect_silence/DetectSilence.py:81:29: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/lib/detect_silence/DetectSilence.py:61:15: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/lib/detect_silence/DetectSilence.py:81:29: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/lib/detect_silence/DetectSilence.py:81:29: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/lib/detect_silence/DetectSilence.py:81:29: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/lib/detect_silence/DetectSilence.py:30:14: W8301: Use tuple instead of list for a non-mutated sequence (use-tuple-over-list)
************* Module unsilence.command_line.EntryPoint
unsilence/command_line/EntryPoint.py:48:39: W8301: Use tuple instead of list for a non-mutated sequence (use-tuple-over-list)
unsilence/command_line/EntryPoint.py:56:33: W8301: Use tuple instead of list for a non-mutated sequence (use-tuple-over-list)
************* Module unsilence.command_line.ChoiceDialog
unsilence/command_line/ChoiceDialog.py:17:31: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/command_line/ChoiceDialog.py:17:31: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/command_line/ChoiceDialog.py:17:31: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/command_line/ChoiceDialog.py:23:15: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/command_line/ChoiceDialog.py:17:31: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/command_line/ChoiceDialog.py:17:31: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/command_line/ChoiceDialog.py:17:31: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/command_line/ChoiceDialog.py:17:31: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)
unsilence/command_line/ChoiceDialog.py:23:15: W8201: Consider moving this expression outside of the loop. (loop-invariant-statement)

-----------------------------------
Your code has been rated at 9.36/10