title: Bottleneck In TPL I Think
body: <p>I'm working on a small winforms app the moves\formats some files based on the content of the files.  I made a few hundred copies of the same file to see how long it took to process the files.  It processes 22000 kb's per second if i only iterate over 10 to 20 files but when i iterate over 150 to 200 files the kb's per second drops down to 11,000.  Of course more files will take longer but why would the kb's per second be dropping so much? The files are identical so what's going on? Here's a skeleton of the code....</p>
  
  <pre><code>       'classA
         For Each f As String In files
              Dim p As New Item(f)
              AddHandler p.InitCompleted, AddressOf DoWork
  
              Task.Factory.StartNew(Sub()
                                        p.StartInit()
                                    End Sub).Wait() 
  
          Next f
  
          'classA - - _scheduler declared at the class level and assigned FromCurrentSynchronizationContext
          Public Sub DoWork()
             'move/format files
              Task.Factory.StartNew(Sub() RaiseEvent AnEvent(intVal1, intVal2), Nothing, Threading.Tasks.TaskCreationOptions.None, _scheduler).Wait()
  
          End Sub
  
          'classItem 
            Private Sub Init() 
                 'search file contents
                  Task.Factory.StartNew(Sub()  RaiseEvent InitCompleted(), Nothing, Threading.Tasks.TaskCreationOptions.None, _scheduler).Wait()
            End Sub
  
            'gui winform
             AddHandler classa.AnEvent, AddressOf OnAnEvent
  
             Private Sub OnAnEvent(ByVal param1 Integer, ByVal param2 As Integer)
                  txtBox1.Text = param1
                  txtBox2.Text = Param2
             End Sub
  </code></pre>
  
  <p>Any input would be greatly appreciated. Answers in c# are fine.</p>