I have a pretty complex java class with over 60 small helper methods used for easy readability and understanding.Just wondering, do you think having these many methods in a class could affect performance in any way?
class MyClass() {
//Some static final variables
MyInnerClass m = loadAllVariables();
private void update(){
}
...
//All 60 methods come here
....
private MyInnerClass loadAllVariables() {
MyInnerClass m = new MyInnerClass();
//load all variables with pre-initialized values
}
private MyInnerClass() {
int a, b, c; //In reality, I have over 20 variables
}
}
No. The number of methods in a method doesn’t matter much. Only the methods used are really loaded. If you have thousands of methods this is more likely to be a problem for you (the developer)
Keeping your code simple and clear is more likely to improve performance.