Overhead of Objects with Many Variables

How much is the difference in overhead of an object with 50-75 variables versus an object with no variables other than the built in ones? Will 300 activated objects with these variables make a large difference in overhead if they aren't currently changing values, just initialized? What about 1000 objects with such variables, 700 of which are deactivated? Will any of these be a problem for 60 fps?
 

TheouAegis

Member
The number of variables an object needs should determine the amount of RAM the object uses. That's about the only concern and in most cases is negligible (less so with phones).

But yes, it has considerably more overhead than if the objects didn't use a bunch of variables.

That said, objects with 10 or so unused variables is insignificant.

To give you an example of how "negligible" this really is, I ran a project with a single controller object and a bunch of objects that each had no new variables in them. The project took up 22MB of RAM. With the press of a button, I created 1000 objects more, each with no new variables. The project took up 2.4MB more. I then made those objects add 1000 variables each and the project jumped up roughly 18MB in RAM use. So 1000 empty objects took up less than 2MB of RAM whereas 1,000,000 variables took up 18MB of RAM. Your question wasn't about anywhere near 1000 variables per object. :p
 
The number of variables an object needs should determine the amount of RAM the object uses. That's about the only concern and in most cases is negligible (less so with phones).

To give you an example of how "negligible" this really is, I ran a project with a single controller object and a bunch of objects that each had no new variables in them. The project took up 22MB of RAM. With the press of a button, I created 1000 objects more, each with no new variables. The project took up 2.4MB more. I then made those objects add 1000 variables each and the project jumped up roughly 18MB in RAM use. So 1000 empty objects took up less than 2MB of RAM whereas 1,000,000 variables took up 18MB of RAM. Your question wasn't about anywhere near 1000 variables per object. :p
So it more effects memory than processing speed? No major difference in execution speed if variable values aren't changing?
 

TheouAegis

Member
A variable is just a variable. Now, if you have so many variables that it is forcing a bank switch, which I'm not sure if that's even an issue on a computer or cell phone, then that could slow things down, but only when reading or writing variables.
 
X

Xione

Guest
The number of variables an object needs should determine the amount of RAM the object uses. That's about the only concern and in most cases is negligible (less so with phones).

But yes, it has considerably more overhead than if the objects didn't use a bunch of variables.

That said, objects with 10 or so unused variables is insignificant.

To give you an example of how "negligible" this really is, I ran a project with a single controller object and a bunch of objects that each had no new variables in them. The project took up 22MB of RAM. With the press of a button, I created 1000 objects more, each with no new variables. The project took up 2.4MB more. I then made those objects add 1000 variables each and the project jumped up roughly 18MB in RAM use. So 1000 empty objects took up less than 2MB of RAM whereas 1,000,000 variables took up 18MB of RAM. Your question wasn't about anywhere near 1000 variables per object. :p
wow, thanks for sharing your findings!
 
Top