• Advertisement
Sign in to follow this  

Using Structs Slower Than Not?

This topic is 2336 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement