+ 7
Do static variables affect performance?
8 Antworten
+ 7
it's quicker for the computer to process multiplication than division, so instead of
int x = 10 / 2;
do
int x = 10 * 0.5
+ 6
No, the last thing I would worry about is the performance unless you will be building apps for devices with limited resources such as phones, tablets. if performance is an issue, multiply instead of divide, and call last functions when possible. Hope that helps.
+ 4
To a certain degree but these days the difference that it makes aren't noticeable, as previous posts mentioned the only time you might want to worry is when you have an extreme amount of calculations and resources are very slim.
+ 2
Yes,since static variable are created only once for a class and not for object
+ 2
thank you. I was kinda confused about that but now I kinda get it :D
+ 1
yes, it is easy to access static members to call because it takes less process
+ 1
yes
- 4
ok but what do u mean by multiply instead of divide ???