Simple-Dialer icon indicating copy to clipboard operation
Simple-Dialer copied to clipboard

Slowness with large Contacts list

Open lfom opened this issue 2 years ago • 4 comments

Hi, there!

Thanks for providing the SimpleMobileTools for free, the private contacts lists is a great idea, and this is the reason I tried to use Dialer (v5.14.0), Contacts (v6.20.0 Pro) and SMS (v5.15.0) apps.

Contacts and SMS work fairly fine, but Dialer takes ages to load at first lunch, no matter what tab is set to open at startup: Contacts, Favorites, Call History, or last used. It is even worse if I enable "merge duplicate contacts" in Contacts app. And even after loading the contents, anything I do, like opening or editing a contact, and even just simply opening the About page and going back, is very sluggish. I have a large contacts list (1900+ contacts), but the Contacts app itself seems to work well, the slowness happens in Dialer only.

I hope this can be improved in a future release. Thanks again.

Regards

lfom avatar Aug 13 '22 11:08 lfom

Try disabling the first or last tab to see if it speeds things up.

tibbi avatar Aug 13 '22 13:08 tibbi

@tibbi Thank you for the quick reply. It seems that the slowness happens only when Call History is enabled, so I guess that is what needs to be improved asap, since it is a needed basic feature for a dialer app IMHO.

lfom avatar Aug 13 '22 14:08 lfom

i confirm this and have new insight. i exported contacts from simple contacts pro, then on other device imported them inside simple contancts pro. result: contacts are not visible to other apps on this phone, but to simple apps only, causing simple sms, simple contacts and especially simples dialer call history (to the extent its barely usable) very noticeable slow downs. if the same exported contacts file was imported on other device by androids build in contact manager (visible to every app on device) the slowness is gone and even simple dialers call history operates fluently.

alekksander avatar Jul 06 '23 05:07 alekksander

@tibbi

I am no Kotlin/Android expert or developer, but taking a look at the code I see:

https://github.com/SimpleMobileTools/Simple-Dialer/blob/9ac6fc2edb301b20c41946e6feaf997d13210239/app/src/main/kotlin/com/simplemobiletools/dialer/fragments/RecentsFragment.kt#L65-L77

The call to RecentsHelper(context).getRecentCalls then fetches contacts again:

https://github.com/SimpleMobileTools/Simple-Dialer/blob/9ac6fc2edb301b20c41946e6feaf997d13210239/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/RecentsHelper.kt#L20-L37

And it seems like getContacts itself does a lot of work:

https://github.com/SimpleMobileTools/Simple-Commons/blob/5b1c01444565ca3b76d6cc48d41b6845b20fe8f8/commons/src/main/kotlin/com/simplemobiletools/commons/helpers/ContactsHelper.kt#L29

On top of that, both getContacts and getRecentCalls use ensureBackgroundThread which can be a bit costly when working on native languages. Perhaps only one can thread can suffice as seemingly getRecentCalls limits its results.

Waqar144 avatar Sep 18 '23 05:09 Waqar144