David's final changes: more profiler features, fixes.
My eyes, they burn! Also runs faster, slightly less buggy.
profileon/profileoff in debugscript
Added a profiler, which outputs time taken and calls to various functions. Disable by defining PROFILER_SILENT You can add a zone with PROFILE_SCOPE(name); (which will profile until the scope is exited) or with g_profiler.BeginZone(name); and g_profiler.EndZone();