title: C# Slow UI Performance when calling BeginInvoke frequently
body: <p>I have a main form called ProxyTesterForm, which has a child form ProxyScraperForm.  When ProxyScraperForm scrapes a new proxy, ProxyTesterForm handles the event by testing the scraped proxy asynchronously, and after testing adds the proxy to a BindingList which is the datasource of a DataGridView.</p>
  
  <p>Because I am adding to a databound list which was created on the UI thread I am calling BeginInvoke on the DataGridView so the update happens on the appropriate thread.</p>
  
  <p>Without the BeginInvoke call in the method I will post below, I can drag the form around on my screen during processing and it doesn't stutter and is smooth.  With the BeginInvoke call, it's doing the opposite.</p>
  
  <p>I have a few ideas on how to fix it, but wanted to hear from smarter people than me here on SO so I solve this properly.</p>
  
  <ol>
  <li><p>Use a semaphore slim to control the amount of simultaneous updates.</p></li>
  <li><p>Add asynchronously processed items to a list outside of the scope of the the method I will post below, and iterate over that list in a Timer_Tick event handler, calling BeginInvoke for each item in the list every 1 second, then clearing that list and wash, rinse, repeat until the job is done.</p></li>
  <li><p>Give up the convenience of data binding and go virtual mode.</p></li>
  <li><p>Anything else someone might suggest here.</p>
  
  <pre><code>private void Site_ProxyScraped(object sender, Proxy proxy)
  {
      Task.Run(async () =&gt;
      {
          proxy.IsValid = await proxy.TestValidityAsync(judges[0]);
          proxiesDataGridView.BeginInvoke(new Action(() =&gt; { proxies.Add(proxy); }));
      });
  }
  </code></pre></li>
  </ol>