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.