Sign in to follow this  
jamesleighe

Using Structs Slower Than Not?

Recommended Posts

If I had a struct, Triangle, would it be slower (even ever so slightly) to work with (access it's vertices) than just using the standard array of floats?
What if triangle had 'Vertex' structs for it's 3 vertices?

Thanks guys.

Share this post


Link to post
Share on other sites
This sort of question is quickly answered *for a given platform* by compiling a couple test cases, asking the compiler to produce an annotated assembly listing for you (/FAs for Microsoft's) and comparing the output. You need to be slightly awkward sometimes to stop the compiler deciding to optimize in ways which are unhelpful (e.g. "you don't use this value, so I'll omit the calculation entirely") but it's a useful skill.

Share this post


Link to post
Share on other sites

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

Sign in to follow this