rvera / image-picker

Image Picker is a simple jQuery plugin that transforms a select element into a more user friendly graphical interface.
http://rvera.github.com/image-picker
Other
906 stars 216 forks source link

Performance above 100 images? #20

Closed georgecoltart closed 10 years ago

georgecoltart commented 10 years ago

Firstly thanks for an amazing plugin, It's helped me out a lot.

I've noticed the performance of toggling the images slows down a lot with pickers that are very large, like 150 or so images. The lag between the mouse click and the highlight appearing is 1-1.5 seconds.

I wouldn't know where to start to optimise this but I was wondering if you had noticed the same thing with larger pickers? thanks

rvera commented 10 years ago

Hi george, I'm glad it has been helpful to you.

I haven't used it on sets bigger than 30-50 so for me the performance has not been an issue, what OS, browser and specs are you using?

georgecoltart commented 10 years ago

OK so I now believe it's not simply the number of images but rather that the imagepicker() function not completely 'destroying' itself when you run it on an existing picker.

(I'm loading new images into the select element 20 at a time, then re-running the imagepicker() function on the existing select element)

To replicate the issue, create a large picker with 50-100 images, then run $('select').imagepicker(); in the console about 10 times. (This reinitialises the picker from the new select element right?)

My guess is that something is not being completely removed/deleted when the function is re-run?

rvera commented 10 years ago

Good call, I'm not properly deleting the callbacks associated to the destroyed dom elements.

rvera commented 10 years ago

Hey George, I couldn't reproduce the same issue but I updated the lib to properly unbind all the events on destroy.

Could you please download the latest version and give it a try?

Thanks

georgecoltart commented 10 years ago

Excellent! it seems like it's resolved, thanks for your work :+1: