title: Performance of Image loading
body: <p>I've been experimenting for a few hours with various ways to load an image from file. Please have a look at these two methods:</p>
  
  <pre><code>    public Image SlowLoad(string path)
      {
          return Image.FromFile(path);
      }
  
      public Image FastLoad(string path)
      {
          using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(path)))
              return Image.FromStream(ms);  
      }
  </code></pre>
  
  <p>The second method is like 2 times faster. What am I missing here? Why is it so? I can't believe that .NET developers couldn't implement Image.FromFile faster simply using the method I wrote. So => I am wrong somewhere. Please tell me where. Why is the second method almost 2 times faster? Is my code fully correct? (thread-safe, etc.). Maybe Image.FromFile is more secure?</p>