We are using Bahmni Connect(Android) for a client and have noticed the following areas where the app could be optimised:
It takes quite a lot of time to open the Consultation forms.
Once you open the Consultation for a particular patient it takes quite a while to load the page. Almost a minute for us using a tablet with the configuration mentioned below
Ram: 2 GB.
CPU: 1.3 Ghz Quad Core
Total events: ~5100
After some investigation and debugging we found out that the problem lies here :https://github.com/Bahmni/bahmni-offline/blob/320aa65a0e2886146c28232f714d9c5761cabacb/android/platforms/android/src/main/java/org/bahmni/offline/dbServices/dao/FormDbService.java#L57
The sql uses the SELECT * from form syntax and on lines 65 to 67 we are only using 3 columns from the table i.e. ‘name’, ‘version’, ‘uuid’.We have some forms that have around 500 concepts. Due to this the query is retrieving all the forms data which is not necessary. After changing the query to just retrieve the necessary fields we saw a huge performance boost. The time taken to open the consultation page dropped from a minute to less than 10 seconds which is a 6x performance boost.
Similarly it also takes a lot of time to save the Obs form data after filling in some data. But this was due to the fact that getAllForms() was being called again after saving and it gave the illusion that saving also takes a lot of time.
The above change also sped up the time taken the save the forms which is around 10-15 secs.
There are a lot of places where select * as been used apart from the above where the changes need to be done.