Skip to content

Parallel.ForEach is actually slow #86218

Open
@superichmann

Description

@superichmann

I have a process which I need to run very fast. when running with parallel.foreach (MaxDegreeOfParallelism = 8) (my cpu is 16) it takes 2 minutes. when changing MaxDegreeOfParallelism to 16 it takes more than 2 minutes. the cpu is not actually sweating (40%)

When splitting the data and running it from two separate EXE processes, it takes 1 minute for both (half time, same data, cpu is 90%).
Anyone knows why? or how can I fix it without running multiple processes? thanks :)

            Parallel.ForEach(sfs, new ParallelOptions { MaxDegreeOfParallelism = 8 }, sf =>
            {var success= PerformFromDatabase(sfString);}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions