B4A Performance

fabioferreiracs

Member
Licensed User
Longtime User
I'm developing an application for access to twitter. But the code grew and was hard to understand. One reason for the complexity is that I have tried to reduce as much as possible the size of the code. I took advantage pieces of code in various routines.
Well, my question is as follows:
what is the impact on performance of an application made ​​in B4A if the source code be greater because some repetitions of internal routines? If the performance impact is not significant is more interesting to keep it greater in favor of a easily understood.
When running, my application uses 14 mb memory. Had some technical reference?
I did some routines that access to external library twitter4j, and ABTwitter. The performance is greatly reduced when using another layer.
For example, by replacing external calls routines the program performance has been significantly improved.
I would like to share some experiences about it.
Thanks !
 

Informatix

Expert
Licensed User
Longtime User
I'm the author of UltimateListView. I profiled and tried to optimize most parts of the main class to make them as fast as possible. The result of this process is not at all surprising:
- since you do not master how B4A convert your code to Java, there are a few optimizations that cannot be done (I don't blame at all B4A; Erel did a really good job and we have to deal with the minor issues left);
- the best way to improve greatly performances is to use the right algorithm (no surprise here, it's true from the beginning of the computer science);
- I had to code a few things directly in Java but it was marginal and it's probably not needed in a lot of apps;
- the less you call external subs the greater the performance, however the gain is very small;
- creating and removing views is slow (I don't think that it's related to B4A).

In brief, my main code is written in B4A, with no particular trick or coding optimizations, and it does not suffer a lot from that fact. Using the proper algorithms is, by far, the best method to improve performance.
To answer more precisely to your question: it is sometimes better for performance to repeat code and having many functions very similar than trying to make only one function that will have to handle every cases (you avoid unneccessary checkings and variable assignments). You'll have to try to know, but I'm pretty sure the gain will be very small.
 
Upvote 0
Top