mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 11:14:45 +00:00
Instruct parallel foreach to not go over the number of processor threads, it's counter productive.
And it should not do it by default but apparently, it does.
This commit is contained in:
@@ -202,6 +202,10 @@ public partial class ImportRoms : ComponentBase
|
||||
_stopwatch.Restart();
|
||||
|
||||
Parallel.ForEach(_rootImporter.Files,
|
||||
new ParallelOptions
|
||||
{
|
||||
MaxDegreeOfParallelism = Environment.ProcessorCount
|
||||
},
|
||||
file =>
|
||||
{
|
||||
_ = InvokeAsync(() =>
|
||||
@@ -284,6 +288,10 @@ public partial class ImportRoms : ComponentBase
|
||||
|
||||
// For each archive
|
||||
Parallel.ForEach(_rootImporter.Archives,
|
||||
new ParallelOptions
|
||||
{
|
||||
MaxDegreeOfParallelism = Environment.ProcessorCount
|
||||
},
|
||||
archive =>
|
||||
{
|
||||
_ = InvokeAsync(() =>
|
||||
|
||||
@@ -99,6 +99,10 @@ public sealed class FileImporter
|
||||
ConcurrentBag<string> archives = [];
|
||||
|
||||
Parallel.ForEach(Files,
|
||||
new ParallelOptions
|
||||
{
|
||||
MaxDegreeOfParallelism = Environment.ProcessorCount
|
||||
},
|
||||
file =>
|
||||
{
|
||||
SetProgress?.Invoke(this,
|
||||
@@ -170,6 +174,10 @@ public sealed class FileImporter
|
||||
ConcurrentBag<string> archives = [];
|
||||
|
||||
Parallel.ForEach(Files,
|
||||
new ParallelOptions
|
||||
{
|
||||
MaxDegreeOfParallelism = Environment.ProcessorCount
|
||||
},
|
||||
file =>
|
||||
{
|
||||
try
|
||||
|
||||
@@ -213,6 +213,10 @@ public sealed partial class ImportRomFolderViewModel : ViewModelBase
|
||||
_stopwatch.Restart();
|
||||
|
||||
Parallel.ForEach(_rootImporter.Files,
|
||||
new ParallelOptions
|
||||
{
|
||||
MaxDegreeOfParallelism = Environment.ProcessorCount
|
||||
},
|
||||
file =>
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
@@ -284,6 +288,10 @@ public sealed partial class ImportRomFolderViewModel : ViewModelBase
|
||||
_stopwatch.Restart();
|
||||
|
||||
Parallel.ForEach(_rootImporter.Archives,
|
||||
new ParallelOptions
|
||||
{
|
||||
MaxDegreeOfParallelism = Environment.ProcessorCount
|
||||
},
|
||||
archive =>
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
@@ -365,6 +373,10 @@ public sealed partial class ImportRomFolderViewModel : ViewModelBase
|
||||
_stopwatch.Restart();
|
||||
|
||||
Parallel.ForEach(_rootImporter.Archives,
|
||||
new ParallelOptions
|
||||
{
|
||||
MaxDegreeOfParallelism = Environment.ProcessorCount
|
||||
},
|
||||
archive =>
|
||||
{
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
|
||||
Reference in New Issue
Block a user