Sunday, June 2, 2013

Taking Performance measures? ALWAYS DO IT RELEASE MODE

So, I started using the font engine for displaying the cost of the entire frame. I added timbars to the engine, to find out how much time a certain section of the code takes on the CPU side. This is really useful for measuring CPU Side cost for any implementation.

With this little gadget, I decided to implement some tonemapping algorithms, and see how much it cost. I was shocked to see that the whole frame costed around 40ms, when I just rendered one model + tonemapping. I spent a lot of time trying to figure out if it was a bad configuration, whether the model was really dense, or was there some issue with my engine?

And then I realized that I was running it Debug Mode. This means de-optimized Built C++ Code, de-optimized shaders, and bloated debug DirectX dlls. I set up the release version correctly, and voila, the time for the total frame came down to 7ms. Which was much close to what I was expecting.

So, just in case you're trying to time something you implemented, ALWAYS DO IT IN RELEASE MODE :).

No comments: