MKRingProgressView icon indicating copy to clipboard operation
MKRingProgressView copied to clipboard

Slow performance in collection view cell

Open gianfilippocisternino opened this issue 7 years ago • 2 comments

I am using this ring progress view inside a collection view. When i start scrolling the collection view and the collection view creates another cell, it is not smooth. I used instruments to see what could be the problem and i noticed that the heaviest function was the method contentImage in the MKRingProgressView class.

Can you please try to see if is there any way to improve performance? Thank you

gianfilippocisternino avatar Aug 23 '17 12:08 gianfilippocisternino

Hello @gianfilippocisternino This control was never intended to be used in performance-critical cases like the one you described, sorry. The control's implementation depends on a gradient image generating, which is a really heavy operation. You can read more here: https://github.com/maxkonovalov/MKGradientView#performance One way to fix this could be a caching mechanism for generated gradient images. Another workaround might be to disable the gradient altogether, leaving only solid color for the rings, but this tradeoff should give a big performance boost, because it would also allow some more optimizations to be made. I'll try to do something with this issue some time in the future, but not quite soon I think... If you make some fixes for this yourself, feel free to submit a pull request, it would really help.

maxkonovalov avatar Aug 23 '17 13:08 maxkonovalov

@gianfilippocisternino I added some optimizations to the control's drawing, please see https://github.com/maxkonovalov/MKRingProgressView#performance for more details. Let me know if it helped!

maxkonovalov avatar Jun 01 '18 16:06 maxkonovalov