CascadesCarnivoreProject / Carnassial

Carnassial: Simplifying Remote Camera Data
Other
3 stars 0 forks source link

Deletion of large number of images / data (e.g., 1000) too slow #38

Closed saulgreenberg closed 8 years ago

saulgreenberg commented 8 years ago

If the user tries to delete a large number of images (say well over 1000) it may:

  1. take a while before the dialog box is visible as many thumbnails have to be created Not sure what the best way to handle this above. Easiest way is to just not show the thumbnails when there are a large number. Better way it to load them as the user scrolls.
  2. Take a long while to actually do the deletion, largely because (I think)
    -- we individually update the database to reset the delete flag and the imagequality. I suspect we can significantly speed this up if we create a version of this.database.UpdateImage that wraps all the database requests into a bulk action (e.g., begin / end)
saulgreenberg commented 8 years ago

A solution may be to use the thumbnail creation version e.g., something like BitmapImage img = new BitmapImage(); img.BeginInit(); img.DecodePixelWidth = 400; img.CacheOption = BitmapCacheOption.OnLoad; img.UriSource = new (Uri (...); img.EndInit();

the img should now contain a thumbnail. This is much more efficient than loading the full size image and then scaling it.

saulgreenberg commented 8 years ago

The above solution (i.e., with DecodePixeWidth) has been implemented. However, deleting the images is still slow - need to update the dialog to provide feedback as to what is going on as it is happening (including disallowing cancelling)

saulgreenberg commented 8 years ago

Thumbnails sizes are now used to generate thumbnails vs. shrinking. A warning to users has also been added for large numbers of deletions. Since large number of deletions are likely rare, this should suffice for now.