How to optimize CPU usage by running multiple vlcs in a single process in Avalonia
Summary
It consumes a lot of CPU by running multiple vlcs in a single process, but it consumes very little when Use multiple processes and one process only uses one vlc
Minimal project and steps to reproduce
- run multiple vlcs in a single process:
use official demo: https://code.videolan.org/videolan/LibVLCSharp/-/tree/3.7.0/samples/LibVLCSharp.Avalonia.Sample and do the loop
for(var i=0; i<16; i++) { var window = new MainWindow(); window.Show(); }
- run a vlc in multiple process:
just use official demo and run Application.exe many times
What is the current bug behavior?
high CPU usage by running multiple vlcs in a single process in Avalonia
What is the expected correct behavior?
low CPU usage by running multiple vlcs in a single process in Avalonia
Does it work on other plaforms? Does it work with the official VLC apps?
My plaform is window10 and haven’t test on other platforms. Yes, it work with the official VLC apps
Relevant LibVLC logs and/or screenshots
Environment
- OS: window10
- Version: 1809(17763.437)
- CPU: Intel(R) Core(TM) i5-8500 CPu @3.00GHz 3.00 GHz
- GPU: Intel(R) UHD Graphics 630
- RAM: 16G
- LibVLC version and architecture: VideoLAN.LibVLC.Windows:3.0.18
- LibVLCSharp version: LibVLCSharp.Avalonia:3.7.0
Possible fixes
without the ability to achieve it