#48 Faster fgChooseVisual

closed
nobody
None
5
2007-09-18
2006-07-23
theconley
No

XVisualInfo* fgChooseVisual( void )
in the file src/freeglut_window.c, has a series of if
statements for each attribute. This will run faster
if written as a switch case for all combinations.

In other words:

switch (fg.DisplayMode)
{
case ...
}

Discussion

  • John F. Fay

    John F. Fay - 2007-09-18

    Logged In: YES
    user_id=70811
    Originator: NO

    I appreciate where a single "switch" block would be faster than a series of "if" statements, but what is being tested in each "if" statement is the setting of a single bit in the "fg.DisplayMode" variable. To put every possible combination into a "switch" statement branch would require over a thousand different alternatives and is not practical.

     
  • John F. Fay

    John F. Fay - 2007-09-18
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks