Note that there are some explanatory texts on larger screens.

plurals
  1. POdotTrace and performance profiling?
    primarykey
    data
    text
    <p>I recently re-wrote my file format writing library. I realized my code was messy, made everything way too complicated, and was generally just hard to keep maintained.</p> <p>So my new library is so much more organized and clean. I realized that many of the ways I accomplished tasks in the old library was WAY more complicated than it needed to be, so I expected my new code to be ALOT faster.</p> <p>Well, not exactly. I tested performance at first by using the Stopwatch class in the .Net framework. My old library was consistently faster, which shocked me, since there were too many improvements and optimizations to count.</p> <p>I then tested both using the dotTrace Performance Profiler. As expected, my NEW library was faster - about 2 <strong>times</strong> faster! My old library measured 62 milliseconds, and my new one measured 28 milliseconds!</p> <p>So I'm not sure what is going on. In Visual Studio my new library is much slower - in fact, it is VERY inconsistent, it will range from a time of 00::00::00.042 to 00::00::00.351!!</p> <p>Does anyone know why this may be happening? dotTrace says it's 2 times faster, the Stopwatch says it is 2-4 times slower.</p> <p>Thanks to everyone for your help.</p> <ul> <li>Alex</li> </ul> <p>EDIT:</p> <p>The code is the same for both libraries, both just reference the new and old library. This was tested on a Console application:</p> <pre><code>class Program { static void Main(string[] args) { Stopwatch sw = new Stopwatch(); sw.Start(); Textstring txt = new Textstring("TestText"); txt.Text = "This is a test textstring."; RdwFile f = new RdwFile("Test"); f.Add(txt); f.Save(); sw.Stop(); Console.WriteLine(sw.Elapsed.ToString()); Console.ReadKey(); } }; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload