MultipleImageSelect icon indicating copy to clipboard operation
MultipleImageSelect copied to clipboard

Could use some performance improvements

Open vibin opened this issue 8 years ago • 2 comments

The library is really slow on phones with photos in thousands (not very unusual!). After digging a bit into the Content Resolver code, I found the culprit. It's the ArrayList.contains() you're doing for each content row, for checking if to add a new album into the ArrayList.

This can be done in a simpler, efficient way, by passing MediaStore.Images.Media.BUCKET_ID for orderBy of Cursor, and then just comparing adjacent IDs instead, to know if it's a new album.

FishBun does it this way and it works great. https://github.com/sangcomz/FishBun/blob/master/FishBun/src/main/java/com/sangcomz/fishbun/ui/album/AlbumActivity.java#L163

Thanks for the nice library!

vibin avatar Jun 05 '16 13:06 vibin

Thanks for the suggestion :) will update soon

darsh2 avatar Jun 08 '16 14:06 darsh2

Commit fc9a4e8 optimises album loading. Earlier logic was to check if image existed and then check if it belonged to a unique album. Presently, album ids are also queried, and first check is performed to see if it is an unique album id. If unique, then check if image existed.

darsh2 avatar Sep 27 '16 16:09 darsh2