© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
82 replies
Super

❔ Parallel.ForEach is actually slow

I have a process which I need to run very fast. when running with parallel.foreach (8) (my cpu is 16) it takes 2 minutes.
When splitting the data and running it from two seperate EXE processes, it takes 1 minute for both (half time, same data).
Anyone knows why? or how can I fix it without running multiple processes? thanks 🙂

Note: changing degree to 16 makes it even slower.
            Parallel.ForEach(sfs, new ParallelOptions { MaxDegreeOfParallelism = 8 }, sf =>
            {
        var success= PerformFromDatabase(sfString);
}
            Parallel.ForEach(sfs, new ParallelOptions { MaxDegreeOfParallelism = 8 }, sf =>
            {
        var success= PerformFromDatabase(sfString);
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

✅ Foreach vs Parallel.ForEach with Async mehtods
C#CC# / help
4y ago
❔ Foreach
C#CC# / help
3y ago
✅ Remove Foreach
C#CC# / help
3y ago
❔ Foreach loop
C#CC# / help
4y ago