+ 7

Do static variables affect performance?

7th Jul 2016, 6:03 AM
Rishi Menon
8 Answers
+ 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
7th Jul 2016, 5:57 PM
Elfren Authorlee
Elfren Authorlee - avatar
+ 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.
7th Jul 2016, 1:19 PM
Elfren Authorlee
Elfren Authorlee - avatar
+ 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.
4th Jan 2017, 5:32 PM
Alex
Alex - avatar
+ 2
Yes,since static variable are created only once for a class and not for object
10th Jul 2016, 9:00 PM
GOURAV KUMAR
GOURAV KUMAR - avatar
+ 2
thank you. I was kinda confused about that but now I kinda get it :D
11th Jul 2016, 12:58 AM
Rishi Menon
+ 1
yes, it is easy to access static members to call because it takes less process
23rd Nov 2016, 7:04 AM
gulshan kumar
gulshan kumar - avatar
+ 1
yes
15th Jan 2017, 2:57 AM
gulshan kumar
gulshan kumar - avatar
- 4
ok but what do u mean by multiply instead of divide ???
7th Jul 2016, 5:16 PM
Rishi Menon