Closed RSully closed 11 years ago
My comment from prior discussion
I've created a branch for testing push/pop of the color picker within a UINavigationController
git fetch
git checkout enhance-nav_controller
~~Branch: https://github.com/RSully/RSColorPicker/tree/enhance-nav_controller Comparison: https://github.com/RSully/RSColorPicker/compare/master...enhance-nav_controller~~
This has been merged into #26
This has been merged into master
@stuartjmoore I agree the issue is likely generating the initial bitmap. I am still interested in keeping it resizable (though I'm not sure how often that would actually be used - right now probably never considering how slow it would be).
Time profiler:
Each of those purple spikes is pushing another view controller.
A few ideas are going through my head:
Combining these ideas yields an interesting approach. Perhaps you would call something like this when the app launches:
[RSColorPickerView prepareForSize:CGSizeMake(256.0, 256.0)];
This could generate that bitmap in the background and then whenever initialized with that size loading would be near-instant.
The downside of course is that these bitmaps would sit in RAM even if the user never needs a color picker.
Edit:
Another time profiler without "Show Obj-C Only":
I've created #28 after someone mentioned the Accelerate.framework to me. This might be the first step in solving these performance issues. If anyone has any experience or input on which direction to head in, let me know.
Wow, well it has been a long week. Besides getting my feet wet with CocoaPods and merging in some contributions, #28 is a huge overhaul.
A brief rundown (work in progress of release notes):
-prepareForDiameter
class method to preemptively create a cached bitmap (computed in background)Some possible issues:
-prepareForDiameter
is calculating? Even more importantly, out of all of the changes made, which ones might not be great ideas? There are a lot of changes in that branch.
Regarding
What happens if a color picker is created while -prepareForDiameter is calculating?
I have changed the implementation to use NSCache (thread-safe) and NSOperations. It should be handled correctly now.
Should bitmaps always cache by default?
I'm still on the fence about this. I'm using NSCache now so even if they did cache by default it shouldn't be a huge burden. However, I have not been able to get it to evict an object (in the simulator) so I still want to do some more on-device testing.
I think it is safe to close this now. I just released v0.8.0 that includes many performance updates. If anyone has any issues please feel free to create a new issue and we can continue this discussion.
See issue #8 starting at this comment: https://github.com/RSully/RSColorPicker/issues/8#issuecomment-17669493
-genBitmap
is slow and causes the color picker to block the main thread during each initialization.Prior discussion:
@simonbs:
@stuartjmoore: