Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    46
  • comments
    67
  • views
    45725

Awesome Progress!!

Sign in to follow this  
Extrarius

277 views

I was just going through some old code when I found a 'TrigTest' program I made to benchmark various trig approximations for a thread here a while back. Since I originally compiled it using VS 2003, I now have VS 2005, and I've heard many complaints about VS 2005's optimizer, I decided to recompile it with the same settings and see how much changed.

Before recompiling it, I ran the existing executable that was made with VS 2003, and the timing portion of the program produced the following results:
Average Execution Duration (Seconds)
Sine = 4.805455441962594e-008
Taylor11Sine = 1.659724629806302e-008
HornerTaylor11Sine = 1.049327498327301e-008
CModestGodApprox = 4.527706733677046e-009
WildMagicApprox0 = 6.152818305119786e-009
WildMagicApprox1 = 1.049418850719854e-008
DevMasterApproxFast = 4.826987787554008e-009
DevMasterApproxAccurateA = 9.475673584212519e-009
DevMasterApproxAccurateR = 9.486954347549761e-009
DevMasterApproxAccurateM = 9.478525902035034e-009
While the code does use templates a bit, it doesn't use anything besides simple calculation operations and a few functions from the Windows API for timing (so any new 'security features' should not affect the timing code). Thus, I was quite surprised to find that the results for the VS2005-compiled version were so vastly different:
Average Execution Duration (Seconds)
Sine = 7.725379342905308e-008
Taylor11Sine = 1.023075111501602e-007
HornerTaylor11Sine = 8.747406444115104e-008
CModestGodApprox = 3.964541303433817e-008
WildMagicApprox0 = 1.161219847773948e-007
WildMagicApprox1 = 1.749508694540787e-007
DevMasterApproxFast = 4.910617969602283e-008
DevMasterApproxAccurateA = 7.110438337833444e-008
DevMasterApproxAccurateR = 7.136199153803070e-008
DevMasterApproxAccurateM = 7.109845804424866e-008
The built-in 'sinf' function almost doubled in execution time, but 'WildMagicApprox0' is over 18 times slower!

If anybody is interested, you can find everything related (source, projects, executables, and assembly output for both vs 2003 and vs 2005) using this link. If there is a way to get the VS 2005 version as fast as the VS 2003 version (without modifying the vs 2003 project to make it worse =-), I'd love to know about it. The settings seem to have converted correctly as far as I could tell, but I avoid vs2005 for the most part so there could be something simple that I'm missing.
Sign in to follow this  


1 Comment


Recommended Comments

Guest Anonymous Poster

Posted

/fp:fast

or

Floating point model - fast in the optimization settings.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!