Implementing performance profiling was crucial to make my game run smoothly.
Timing functions works very similarly to how I later did it in my Terrain Designer application, every time the function gets called the duration of the call gets measured. After every frame, results are drawn into a graphic on screen that keeps overwriting the oldest entry it has. This allowed me to immediately see which functions were slow, how often they were called and which other functions they were usually called with.
By having this information I could see which parts of my code were slow and needed changing, then I could further explore why that specific part was slow. But if I did not have this real time profiler, I could only guess as to which parts of my code needed looking at.
I also added other debugging information, such as a log that shows which files were accessed and an overview of the level to show which regions are currently considered active and would have the enemies in them updated, etc.
Combined with a debug menu that lets me spawn enemies, add items, set world state and transport to other locations, I have created many useful tools for testing and debugging my game.