Re: Shared NSTextView
Re: Shared NSTextView
- Subject: Re: Shared NSTextView
- From: Douglas Davidson <email@hidden>
- Date: Tue, 19 Aug 2008 09:23:47 -0700
On Aug 18, 2008, at 9:46 PM, Oleg Krupnov wrote:
I could go the simple and dull way and create a separate instance of
NSTextView for each box, but I am afraid this could be a waste of
resources, because layout manager is costy. Also, most of time I only
need to display text in boxes, not to edit it.
Costly is a relative term. Do you have thousands of these boxes, or
only dozens? There are optimizations that the Cocoa frameworks
themselves will make, because they have to consider the possibility
that some application will need them to scale much more than most.
That doesn't necessarily mean that your application needs to make the
same sorts of optimizations.
The controls in the framework share text views via the field editor
mechanism, for example, which helps because we have no idea how many
controls an app may want to use--furthermore, that mechanism was
designed at a time when machines had orders of magnitude less in the
way of resources than they do today. If there's an easy and simple
way to do things, but you're worried it might be too costly, I'd
suggest trying it and using it until measurement shows that it
actually is too costly. If you need to optimize, I think that the
examples people have mentioned should show how to do it.
Douglas Davidson
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden