title: Deserialization slow performance in Unity
body: <p>I am making a 3D simulator in Unity. <br>
  For this simulator I need some data which I store in a Serializable object. <br>
  This object is defined in a DLL file that I made.<br>
  I deserialize it with this code:</p>
  
  <pre><code>public class myObject
  {
      static public myObject LoadFromFile(String Path)
      {
          System.Runtime.Serialization.Formatters.Binary.BinaryFormatter BF = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
          System.IO.FileStream FS = new System.IO.FileStream(Path, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read);
          myObject Result = BF.Deserialize(FS) as myObject;
          FS.Close();
          return Result;
      }
  }
  </code></pre>
  
  <p>My unity program has a reference to the class library containing the definition of 'myObject'. <br>
  If I run the deserialization function from Unity this process takes 35.080 seconds.</p>
  
  <p>If I run this in a windows application, which I created for testing purpose and refers to the same class library and opens the same file, this process takes only 0.260 seconds.<br></p>
  
  <p>It takes a long time in Unity even if I run this process asynchronously.</p>
  
  <p>I wonder why it takes that much longer when I run this code from Unity?
  and if there is anything that I can do about this?</p>
  
  <p>Thanks in advance, <br>
  Maarten</p>