Why does this Parallel.ForEach loop not improve performance?

I have the following code:

           if (!this.writeDataStore.Exists(mat))
            {
                BlockingCollection<ImageFile> imageFiles = new BlockingCollection<ImageFile>();
                Parallel.ForEach(fileGrouping, fi => DecompressAndReadGzFile(fi, imageFiles));


                this.PushIntoDb(mat, imageFiles.ToList());
            }

DecompressAndReadGzFileis a static method in the same class that contains this method. According to the method name, I decompress and read gz files, there are a lot of them, that is, up to 1000, so the overhead of parallelization is worth it for the benefit. However, I do not see the benefits. When I use the ANTS performance profiler, I see that they work in exactly the same way as if parallelization did not occur. I also check the processor cores with the help of the process explorer, and it looks like the two cores may work, but it seems that one main activity does most of the work. What I don’t understand is how much Parallel.ForEach allows you to unpack and read files in parallel?

: . ?

():

  • .gz(1200).
  • , "DATA:", .
  • "DATA:" ( ) (, )

Parallel.ForEach, , , CPU 1 .

+5
2

, , -? , , . , , , , , ... , , , , .

- , , ramdisk, - . , , , .

( , . ? , , .)

+12

, . . fileGrouping?

0

All Articles