File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes performance overhead for setters and getters in Android? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "performance overhead for setters and getters in Android?" Watch "performance overhead for setters and getters in Android?" New topic
Author

performance overhead for setters and getters in Android?

x kevik
Greenhorn

Joined: Dec 17, 2012
Posts: 2
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?
Will Zelan
Ranch Hand

Joined: Apr 15, 2012
Posts: 56

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: performance overhead for setters and getters in Android?