Sent from my iPad

On 15 Feb 2013, at 19:42, Maximilian Marcoll <m...@dis.playce.info> wrote:

> 
> Hi everyone!
> 
> I have a problem with bindings, or so it seems. 
> 
> In my application, I need to programmatically create lots of small views 
> embedded in a big view.
> Think of them as draggable items on a plane.
> 
> Thus far I'm controling the views using bindings. Four bindings per view to 
> be precise. 
> The bindings bind the views to controller objects, which are connected to my 
> model objects.
> The bindings are used to change the model objects' values according to their 
> size and their position on the plane and vice versa.
> 
> If I the app has to manage only a small number of items everything works 
> fine. 
> But when there are very many items (views) to create, the app slows down 
> considerably and is basically unuseable.
> 
> I assumed that I somehow wrote very unefficient code in my views or something 
> like that and I used the Time Profiler to see what actually is the most time 
> consuming operation.
> It appears that the method consuming 90% of the time is:
> -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] .

Ok, and what inside of this method is taking up the time?

In my experience the act of creating or tearing down a lot of observations is 
pretty slow; can you avoid making so many bindings in one go? Perhaps recycle 
existing bindings rather than recreating anew?

Secondly, what do your model objects inherit from? If they're direct NSObject 
subclasses, an easy win for KVO performance is to implement 
-setObservationInfo: and getter method too.
> 
> Now, I'm obviously missing something here. What I want is to have lots of 
> small rectangular items on a plane. 
> Hundreds, or even thousands of them.
> I want to be able to drag them around, change their size and have those 
> properties change values in my model. 
> 
> It seems very unlikely to me that creating bindings for those views is 
> actually that time consuming by itself.
> Or is it?
> 
> Any help is much appreciated!
> 
> Thank you!!
> 
> 
> 
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to