After updating to the latest ZDoom I got massive slowdowns in GZDoom's GL renderer. After doing some checks what has changed the only thing I could come up with is the change in the profiling code so for testing I commented out the calls to QueryPerformanceCounter - and the slowdown vanished.
I tried to step through this function in the debugger but all I could get to was a 'sysenter' instruction so I couldn't see how much code really was executed just to get this timer value.
Profiling QueryPerformanceCounter revealed the following information:
The frequency is 0.00007 milliseconds
Each call takes approx. 10 units
In detailed scenes GZDoom's GL renderer can call this function several 10000 times.
This happened on an Intel CoreQuad 2.4GHz with Windows Vista running.
The sad conclusion: This function is useless for high performance profiling that requires more than a few hundred calls per frame. Any chance to change it back to the old method? That one had no performance impact at all.
QueryPerformanceCounter is a performance killer
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Re: QueryPerformanceCounter is a performance killer
Ten thousand? ZDoom only uses it perhaps a dozen or so times per frame.Graf Zahl wrote:In detailed scenes GZDoom's GL renderer can call this function several 10000 times.
Feel free to reinstate the old code for GZDoom. As long as you're aware that threads can move between cores depending on overall system load, there is no guarantee that time stamp counters are synchronized between cores, and power management features can make the actual rate of the counter fluctuate wildly, there should be no problems.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49226
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: QueryPerformanceCounter is a performance killer
Yes, then thousand. On highly detailed maps like P:AR's E1M3 with the crane it peaked at 40000.
I need to see how much time is spent processing walls, flats and sprites - and separate calls for the time spent to render them.
Still, since I consider this realistic profiling, what's the point of a performance killing performance counter? It's a contradiction in terms. That one function needs more time to retrieve the timer than it takes to execute the code I am profiling...
I need to see how much time is spent processing walls, flats and sprites - and separate calls for the time spent to render them.
Still, since I consider this realistic profiling, what's the point of a performance killing performance counter? It's a contradiction in terms. That one function needs more time to retrieve the timer than it takes to execute the code I am profiling...
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49226
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: QueryPerformanceCounter is a performance killer
Since I reimplemented the RDTSC based timer for GL profiling in GZDoom I think this can be closed now.