Performance of recompiled T2D.EXE
by John Pritchett · in Torque Game Builder · 12/26/2005 (6:08 pm) · 6 replies
I'm attempting to optimize my T2D project, and I decided to set up a visual studio project so I could explore the code to see where optimizations are most useful. After a few hurdles, I managed to get the engine compiled under VC7. The release version compiles to about 2.4 meg, about 400K larger than the T2D.exe that comes with v1.0.2. When I ran it, it ran at about half the frame rate of the original T2D. I thought this might have something to do with VC7, so I compiled it under VC6 and got the same results.
I assumed that the T2D.EXE that shipped with T2D would be the same executable that is compiled with the default project settings. What am I missing?
I assumed that the T2D.EXE that shipped with T2D would be the same executable that is compiled with the default project settings. What am I missing?
About the author
Indie developer since 1994, games include TradeWars 2002 (named 10th best PC game of all time by PCWorld magazine), TW: Dark Millennium/Exarch/Dungeon Runners, and Rocketbowl 360. Have worked for Martech Software, 21-6, EIS and Black Squirrel Studios.
#2
Using the spacescroller app as a benchmark, I only see about 10 frames per second decrease with my compiled version, from about 100 FPS average to about 90 FPS average on a 1 GHz P3 with 64 meg Geforce4 mx440. My game seems to be more effected by this decrease, running, as I said, at about half the framerate. So something is different about the distribution T2D.EXE and I'd really like to know what it is. Please?
[edit]Ok, I'm going to have to say that the spacescroller app runs at basically the same speed with both compiles, but that really just makes it all the more confusing that my app runs twice as fast with the distribution compile as it does with the default optimized VC6 compile. It's not running that fast even with the distribution compile on this test rig (which is why I'm trying to optimize), only about 40 FPS, but after I compile, it runs at around 20 FPS and drops down into the 5 FPS range at times. It's very discouraging.
Does it matter that I'm compiling with VC6 and VC7 standard editions? Are there more options for optimizations on the higher-end versions of these compilers?
Any hints would be appreciated.
12/26/2005 (10:01 pm)
I probably didn't make it clear enough, but I did compile the release version. Of course, I used the preset optimizations. Like I said, it just seems logical that the presets for the release compile would match those used to compile the actual T2D.EXE that was distributed, and that doesn't seem to be the case. If it's not, it would be great to see a list of the optimization settings that were used so I don't have to rediscover the best combination of settings. The T2D.EXE that shipped with v1.0.2 runs very well, roughly twice as good as the default compile.Using the spacescroller app as a benchmark, I only see about 10 frames per second decrease with my compiled version, from about 100 FPS average to about 90 FPS average on a 1 GHz P3 with 64 meg Geforce4 mx440. My game seems to be more effected by this decrease, running, as I said, at about half the framerate. So something is different about the distribution T2D.EXE and I'd really like to know what it is. Please?
[edit]Ok, I'm going to have to say that the spacescroller app runs at basically the same speed with both compiles, but that really just makes it all the more confusing that my app runs twice as fast with the distribution compile as it does with the default optimized VC6 compile. It's not running that fast even with the distribution compile on this test rig (which is why I'm trying to optimize), only about 40 FPS, but after I compile, it runs at around 20 FPS and drops down into the 5 FPS range at times. It's very discouraging.
Does it matter that I'm compiling with VC6 and VC7 standard editions? Are there more options for optimizations on the higher-end versions of these compilers?
Any hints would be appreciated.
#3
FYI i turned on a lot of these and they work well, though i havent really noticed any real speed up in performance (but i havent dont a lot of 'real' games in t2d yet)
Also, as far as .exe size, it probably is because of additional .libs and #includes in the vs project that were disabled (commented out) in whatever build system the garagegames guys used to build t2d_debug.exe
as far as compile setting that i think should affect performance, definatly floating point optimizations, though also inline functions and the "full code optimization" setting should help.
hope that helps. sorry i cant be more exact, i'm not a C++ guy, so i only do what i need to get my crap done :)
12/27/2005 (3:06 pm)
Fyi, there are a lot of other optimizations that can/should be turned on in Release mode. FYI, the VS project files that ship with t2d have a lot of these turned off, so you will have to go through and turn them on.FYI i turned on a lot of these and they work well, though i havent really noticed any real speed up in performance (but i havent dont a lot of 'real' games in t2d yet)
Also, as far as .exe size, it probably is because of additional .libs and #includes in the vs project that were disabled (commented out) in whatever build system the garagegames guys used to build t2d_debug.exe
as far as compile setting that i think should affect performance, definatly floating point optimizations, though also inline functions and the "full code optimization" setting should help.
hope that helps. sorry i cant be more exact, i'm not a C++ guy, so i only do what i need to get my crap done :)
#4
There is also the (free) "Visual C++ toolkit 2003" that contains the fully optimized compiler. I never used this in the past, but here's a link that claims to show you how to get it working with VC 7.
xona.com/2004/06/29.html
12/27/2005 (5:06 pm)
VC 7 "standard" edition doesn't compile with optimizations. I think this may also be true for VC 6. I've been using the free VC 8 (2005 express) that uses the same compiler as the pro version. I haven't done any benchmarking, but haven't run into any issues either.There is also the (free) "Visual C++ toolkit 2003" that contains the fully optimized compiler. I never used this in the past, but here's a link that claims to show you how to get it working with VC 7.
xona.com/2004/06/29.html
#5
12/27/2005 (8:54 pm)
Another note about the Toolkit compiler. You can actually install it such that VC++ 7.0 standard looks for the improved compiler. It is a bit more difficult to turn on the optimization flags (you have to add them manually), but it does work. And it costs a whole lot less than VC++ 7.0 Pro.
#6
12/27/2005 (10:45 pm)
Keep in mind that some optimizations will break the app, so you will have to mix/match stuff to get it right.
Torque Owner Jason Swearingen
also, there is a lot of compile-time optimizations you can turn on in VS. you will have to play with it a bit to find out what's right for you though.