Skip to content
This repository has been archived by the owner on Dec 28, 2022. It is now read-only.

Fix slow library loading with a lot of inclusions or exclusions #535

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Andrius-B
Copy link

This closes #534 - the library loads very slowly when there are entries in the blacklist. Seems that I found the issue - there was a hidden O(N^2) loop in the incl/excl filtering algorithm.
I converted the include/exclude path lists to hash sets that have fast member checks and this seems to solve the performance problems:

[(no exclusions) + app start..]
2021-08-24 21:00:50.683 15138-15138/com.simplecity.amp_pro.debug I/PERF: Requested album load
2021-08-24 21:00:51.159 15138-15205/com.simplecity.amp_pro.debug I/PERF: Albums loaded 295 in 476ms
[app restart..]
2021-08-24 21:01:14.905 15356-15356/com.simplecity.amp_pro.debug I/PERF: Requested album load
2021-08-24 21:01:15.357 15356-15434/com.simplecity.amp_pro.debug I/PERF: Albums loaded 295 in 451ms
[blacklist spotify cache folders + app restart..]
2021-08-24 21:02:02.308 15773-15773/com.simplecity.amp_pro.debug I/PERF: Requested album load
2021-08-24 21:02:02.677 15773-15839/com.simplecity.amp_pro.debug I/PERF: Albums loaded 188 in 368ms
[app restart..]
2021-08-24 21:02:24.031 16003-16003/com.simplecity.amp_pro.debug I/PERF: Requested album load
2021-08-24 21:02:24.455 16003-16108/com.simplecity.amp_pro.debug I/PERF: Albums loaded 188 in 423ms

Now if I'm not mistaken, this should now be O(N) and scale a little better.

@CLAassistant
Copy link

CLAassistant commented Aug 24, 2021

CLA assistant check
All committers have signed the CLA.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slow library loading with more entries in exclusion list
2 participants