HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Speed of structs?

08-04-2007, 09:34 PM#1
Lordy
Hey,

I just started using struct because I was using a lot of handlevars and with structs I don't have to =)
But em.. do I need to worry about overusing structs? I reckon 'normal' variables are faster than structs. Or are structs so fast I can use em all I like?
08-04-2007, 09:42 PM#2
botanic
anything that is overused can cause lag however under normal circumstances there wont be any problem using as many as you like (try not to use 10000 every .01 seconds tho ;P)

As a general rule if you have no memory leaks and is optimized mostly anything can be used as many times as you want. (this doesnt apply to anything that uses graphics just programming)
08-04-2007, 09:45 PM#3
cohadar
Structs do a direct array lockup,
so basically they are as fast as normal variables.
(Difference is in nanoseconds)

So no you cannot overuse structs,
they are actually faster than handlevars.
08-04-2007, 11:06 PM#4
botanic
well you can overuse then just it would take a lot ;P

like if you call an array for loop integer A from 1-1000 every .01 seconds ;P