Jump to content
  • Advertisement
Sign in to follow this  
jamesleighe

Using Structs Slower Than Not?

This topic is 2635 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
×

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!