Does the number of classes show any impact on the speed of an application?

For example if there are more number of classes (or packages) does it make the application to run slow compared to the one that has less number of classes (or packages)?

Thanks in advance.

Recommended Answers

All 7 Replies

No it doesn't. What it make slow is complex nested if-else statements

And does passing array lists between classes show any impact on speed?

My problem is I am using seperate adapter classes and created an application.
But my team lead asked me to reduce the number of classes because it effects the speed.

But my team lead asked me to reduce the number of classes because it effects the speed.

Could it be that he asked you to minimize number of classes where the array is passed through before used instead of reducing actual class count of the project?

Without knowing more about project, what sort of data are passed around and for what reason, it would be pointless to give some definetive answer.

If data are static you may want to place them in resource folder as array, if they dynamic, provided by user, you may consider use of SharedPreferences or database.

The data is from the service .
I am passing an array list to set a custom adapter like

mListview.setAdapter(new MyCustomAdapter(this , array_List));

I am having 4 activities where i need to set a custom adapter and i used the custom adapter in a seperate class file (like rather using it in the same file where i wrote the activity.

does the passing of arraylists effect the speed?

Yes, especialy since Android keep history when you move backwards

ok thanks for the information.
So i understood that the number of classes wont effect the speed but passing of information between classes matter.
Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.