[CLOSED] Wildly varying performance (T3D)
by Keith G Wood · in Technical Issues · 03/26/2011 (8:10 pm) · 5 replies
The problem I am seeing is the same game (absolutely no changes to code at all) will, on the same machine, give wildly differing performance on different runs. I've been noticing this for a while now, but haven't been able to derive any context as to what might be impacting things. In fact for a while I'd just put it down to using an old (& well in need of an upgrade) laptop. However, I'm starting to see patterns, so although the information I have is far from complete, maybe it will ring some bells for someone.
Also, I've just been able to try a second machine, and it shows the problem too - so I can eliminate it being something oddball about one machine.
First machine is an old dual core laptop, plain vanilla graphics card. Normally shows ~15 FPS (not good, but good enough to develop the game logic). When things go wrong it can drop to less than 1 FPS. Second machine is brand new with a proper 3D card. Normally shows 70 - 90 FPS. When things go wrong it can drop to less than 10 FPS.
So the impact on performance when things go wrong is severe. Here are some specific observations:
It can go wrong mid game. But usually I just suddenly discover my next run of the game is in slow mode. The rest of the applications on the machine do not seem to have their performance impacted.
The amount of time since the machine was rebooted, or the quantity of other applications loaded & running, doesn't seem to impact the problem. I've had slow mode occur on the first run after a full reboot, with virtually nothing else loaded (& conversely I've had good performance after the machine hasn't een rebooted for days, and loads of other stuff loaded & running).
My machine is not out of physical memory (i.e. it's NOT the case the machine has gone into a memory/disk swap phase).
Using process explorer I can see the game exe gets 50% CPU, regardless of whether the performnce problem is currently showing up.
Process explorer shows no new processes (or any unexpected processes at all) when in poor performance mode (i.e. it doesn't look like something has loaded itself & started doing something behind the scenes to steal my CPU).
I can abandon the game during poor performance. Come back some time later, having (so far as I am aware) done nothing to the machine, and normal good performance is back.
Due to a somewhat dodgy internet connection I have observed that the start of poor performance can be simultaneous with the restortion of an internet connection (although it can also start at other times). I've seen this twice now - althouh I accept it may just have been a coincidence. There is a full up-to-date anti virus suite (before someone asks). (I'm not using network in my game).
I have very little regularly running script. The majority is event driven, there are at most two tick driven bits of script (by using schedule to get a function to repeat itself) - one is set to run every 250ms, the other every 500ms. Both are very tight with very few actual lines of script code per execution iteration.
I have one piece of event driven script code which generates two new TSStatic models one after the other - so one would expect to see these appear on screen virtually simultaneously. Yet I've just caught the poor performance mode take over one second between the two models appearing (of course I dont know if the delay is due to the scripting, or the model creation itself, being CPU starved).
When the game is suffering from poor performance, the world editor seems OK - so it's not the quantity/complexity of the models in my world on its own which is slowing down frame rendering - something else must be implicated.
I know there's not a lot to go on - but has anyone else noticed anything similar? Better still, any suggestions as to what it might be?
If I was to hazard a guess, it's as if something is in a CPU-intensive loop pending some resource availability.
Also, I've just been able to try a second machine, and it shows the problem too - so I can eliminate it being something oddball about one machine.
First machine is an old dual core laptop, plain vanilla graphics card. Normally shows ~15 FPS (not good, but good enough to develop the game logic). When things go wrong it can drop to less than 1 FPS. Second machine is brand new with a proper 3D card. Normally shows 70 - 90 FPS. When things go wrong it can drop to less than 10 FPS.
So the impact on performance when things go wrong is severe. Here are some specific observations:
It can go wrong mid game. But usually I just suddenly discover my next run of the game is in slow mode. The rest of the applications on the machine do not seem to have their performance impacted.
The amount of time since the machine was rebooted, or the quantity of other applications loaded & running, doesn't seem to impact the problem. I've had slow mode occur on the first run after a full reboot, with virtually nothing else loaded (& conversely I've had good performance after the machine hasn't een rebooted for days, and loads of other stuff loaded & running).
My machine is not out of physical memory (i.e. it's NOT the case the machine has gone into a memory/disk swap phase).
Using process explorer I can see the game exe gets 50% CPU, regardless of whether the performnce problem is currently showing up.
Process explorer shows no new processes (or any unexpected processes at all) when in poor performance mode (i.e. it doesn't look like something has loaded itself & started doing something behind the scenes to steal my CPU).
I can abandon the game during poor performance. Come back some time later, having (so far as I am aware) done nothing to the machine, and normal good performance is back.
Due to a somewhat dodgy internet connection I have observed that the start of poor performance can be simultaneous with the restortion of an internet connection (although it can also start at other times). I've seen this twice now - althouh I accept it may just have been a coincidence. There is a full up-to-date anti virus suite (before someone asks). (I'm not using network in my game).
I have very little regularly running script. The majority is event driven, there are at most two tick driven bits of script (by using schedule to get a function to repeat itself) - one is set to run every 250ms, the other every 500ms. Both are very tight with very few actual lines of script code per execution iteration.
I have one piece of event driven script code which generates two new TSStatic models one after the other - so one would expect to see these appear on screen virtually simultaneously. Yet I've just caught the poor performance mode take over one second between the two models appearing (of course I dont know if the delay is due to the scripting, or the model creation itself, being CPU starved).
When the game is suffering from poor performance, the world editor seems OK - so it's not the quantity/complexity of the models in my world on its own which is slowing down frame rendering - something else must be implicated.
I know there's not a lot to go on - but has anyone else noticed anything similar? Better still, any suggestions as to what it might be?
If I was to hazard a guess, it's as if something is in a CPU-intensive loop pending some resource availability.
About the author
The perverse mind behind Bad Taste Software: http://www.badtastesoftware.co.uk
Recent Threads
#2
However, given that (when it gets into this mode) I can stop & restart the game several times with it stuck in slow performance mode; I will try one of the demos next time it happens (just to see if it does affect the demo games the same as my own). Of course, when I'm wanting it to happen it'll probably take days to show up again!
03/27/2011 (5:16 am)
I wouldn't say it is directly connected to an immediately preceeding open / save / close of the world editor. I do this a lot without any impact on performance; and I've had the drop in performance when I haven't been through that sequence. I'm mostly dipping into a text editor to adjust script, then re-running the game - so I most often see the performance drop after doing that - but I'm guessing that's just because is what I do most, rather than that causes it.However, given that (when it gets into this mode) I can stop & restart the game several times with it stuck in slow performance mode; I will try one of the demos next time it happens (just to see if it does affect the demo games the same as my own). Of course, when I'm wanting it to happen it'll probably take days to show up again!
#3
I do the same thing, go in and out rapidly and it seems to corrupt the prefs.cs for a short time. I haven't looked into it at all, though I can get it to do it on every computer that I own, and it is completely random. I can go from 220fps to 3fps simply by going in and out of the exe rapidly. Replace the prefs.cs and all is fine again.
I had found the actual pref that causes the slowdown, but it did not interest me enough at the time to remember it now.
03/27/2011 (12:18 pm)
Next time it does it, replace your prefs.cs with a vanilla install prefs.cs.I do the same thing, go in and out rapidly and it seems to corrupt the prefs.cs for a short time. I haven't looked into it at all, though I can get it to do it on every computer that I own, and it is completely random. I can go from 220fps to 3fps simply by going in and out of the exe rapidly. Replace the prefs.cs and all is fine again.
I had found the actual pref that causes the slowdown, but it did not interest me enough at the time to remember it now.
#4
I have FPS in the main HUD display. This is still active when in the GUI edittor.
When things are normal, it shows ~140 when in the GUI edittor. When things are slow, it shows ~60 when in the GUI edittor. As before, it can change between the fast & slow (& back) without any change to the game.
I'm coming to the conclusion it's something about this machine - except I've seen it once on another machine.
04/03/2011 (5:48 am)
One new observation.I have FPS in the main HUD display. This is still active when in the GUI edittor.
When things are normal, it shows ~140 when in the GUI edittor. When things are slow, it shows ~60 when in the GUI edittor. As before, it can change between the fast & slow (& back) without any change to the game.
I'm coming to the conclusion it's something about this machine - except I've seen it once on another machine.
#5
The last time it happened I went through shutting down others apps on my machine. I shutdown Outlook & IE together, and after that normal speed was restsored. Since then I've avoided running these apps at the same time as Torque, and the problem has not happened again.
So - it seems there may be some conflict with conflict with these apps, but I've no idea what it might be, and the evidence is flimsy & circumstantial. But I seem to be working OK now, so no point keeping this open.
04/09/2011 (7:57 pm)
I'm marking this as "closed" because although I dont really know what's causing my problems, I do now seem to be able to avoid it.The last time it happened I went through shutting down others apps on my machine. I shutdown Outlook & IE together, and after that normal speed was restsored. Since then I've avoided running these apps at the same time as Torque, and the problem has not happened again.
So - it seems there may be some conflict with conflict with these apps, but I've no idea what it might be, and the evidence is flimsy & circumstantial. But I seem to be working OK now, so no point keeping this open.
Torque Owner Brian Mayberry
Dead on Que Productions
Do you open the world editor and save immediately before you see this FPS drop?