performance overhead for setters and getters in Android?
posted 4 years ago
When I was learning Java standard edition, getter and setter functions were often used to hide variables and to reduce direct access to them. I have been told by several sources that in Android you should not use these functions and only modify the variables directly. The reason is that there is a performance loss due to overhead when using getters and setters is used in Android. Resulting in more memory use and slowing down the system.
Is there any truth to this? and if there is, why the performance loss for using getter and setter?
I don't think so. I really really don't think so.
If you're concerned about any possible performance or memory problem associated with getters and setters you'll probably want to write C++ code in the NDK.
Seriously though, you'll probably have a bigger performance hit showing something on the screen.
Lasagna is spaghetti flvored cake. Just like this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user