Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement concurrent recursion when appending items to the playlist #59

Merged
merged 11 commits into from
Jun 21, 2022

Conversation

CogentRedTester
Copy link
Owner

@CogentRedTester CogentRedTester commented May 28, 2022

When recursing through a directory to append its contents to the playlist run
each parse operation concurrently.

This feature has the potential for massive speed improvements when recursively
opening large directories while using addons with asynchronous IO.
This feature can bring addon performance more in-line with the native
parser (which is usually faster for local filesystems).
Network file systems in particular will benefit from this significantly.

The only downsides compared to the default loadlist that I am currently aware of
are higher CPU load (mpv and file-browser are less responsive), and less-predictable append speeds.
The overall time it takes to append the whole directory tree will certainly be less, but it may take longer
to load the first or any subsequent items.

If the number of concurrent recursions is too high then there is the risk of the mpv event
queue overflowing. The mpv event queue is seemingly limited to 1000 items, but only async
mpv actions like command_native_async should use that, events like mp.add_timeout should
be handled entirely on the Lua side with a table, which has a significantly larger maximum size.
Therefore, as long as the max_concurrency value is kept well below 1000 (to allow for addons
creating more than one event each) we should not be at risk.

If this feature is enabled when not using asynchronous IO the behaviour
should be roughly the same as the default, but performance may degrade slightly.

As this is still an experimental feature it will be disabled by default.

this means that the flag can be changed from any point in the appending
process
This feature has the potential for massive performance improvements when
recursively opening large directories while using addons with
asynchronous IO.
@CogentRedTester CogentRedTester added the enhancement New feature or request label May 28, 2022
@CogentRedTester CogentRedTester merged commit 6d854ee into master Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant