Slowdown!

Started by
21 comments, last by Drythe 18 years, 11 months ago
Open the Project Settings. First make sure the correct project and build configuration are selected. Then select the C/C++ tab and the Optimizations category. You should have "Maximize Speed" selected, and make sure the inline function expansion is not disabled. You may want to try changing it from "Only __inline" to "Any Suitable". Visual Studio 6.0 also has some pragmas that affect function inlining, but I'm not sure if they help at all. They are:

#pragma auto_inline( [{on | off}] )#pragma inline_depth( [0... 255] )#pragma inline_recursion( [{on | off}] )


Aside from that, try using an array of POINT3D objects like I suggested earlier. This will let you know if the compiler is making unfair optimizations based on the fact that the data isn't changing.

Oh, and click on the tiny "faq" link near the top-right corner of the page to find out how to create those source code boxes.
Advertisement
Something is fishy with the code you posted. The code shows GetLength as a free top-level function. The assembly on the other hand shows it as CGame::MoofGetLength. Which is it?

Assuming that CGame::MoofGetLength is correct, I don't think VC6 will inline member functions unless the inline code is in the class definition directly. It definitely won't do it if the called function is in a different file caller.

i.e. if you have this:

class CGame{    inline const float MoofGetLength(const POINT3D& Vector);};inline const float CGame::MoofGetLength(const POINT3D& Vector){// yadda yadda}


Change it to:

class CGame{    inline const float CGame::MoofGetLength(const POINT3D& Vector)    {    // yadda yadda    }};



If that doesn't do it you can also try __forceinline instead of just inline. It's MS specific though and should be used only if you are absolutely sure you need it.
-Mike
yeah, the POINT3D array seems to be slowing down the good loop now

This topic is closed to new replies.

Advertisement