title: Speed-optimise a Windows Forms application
body: <p>How do I speed optimize Windows Forms applications?</p>
  
  <p>I am not talking about apparent .NET optimisation techniques - like <a href="http://en.wikipedia.org/wiki/Native_Image_Generator" rel="nofollow noreferrer">NGEN</a>-ing, caching objects, etc. I already tried that and what I am up to is to reduce the form initilization time from a 1500&nbsp;msec down to 500&nbsp;msec.</p>
  
  <p>Profiling has identified the slowest code and almost all of it is in the <code>InitializeComponent</code>, and within this method the slowest lines is </p>
  
  <ol>
  <li>creation of the (just new-ing) WebBrowser component</li>
  <li>loading icon from a resource (hideous 500&nbsp;msec)</li>
  <li>creation of the <code>ContextStripMenu</code></li>
  <li>several <code>this.Controls.Add()</code> calls contribute a lot too.</li>
  </ol>
  
  <p>At the moment, I can only see how to fix point (2) - move icon data from being stored as embedded resource to a private field (for example, <a href="http://en.wikipedia.org/wiki/Base64" rel="nofollow noreferrer">Base64</a>-encoded string).</p>
  
  <p>What what should I do with points 1, 3 and 4?</p>