Re: Optimising an app for battery power use?
Re: Optimising an app for battery power use?
- Subject: Re: Optimising an app for battery power use?
- From: Guy English <email@hidden>
- Date: Tue, 15 Mar 2005 10:45:24 -0500
Keith Blount <email@hidden> wrote:
> In my program I have a text view and I am doing a lot
> of things in the -textDidChange delegate method
> (updating a lot of other elements that need to reflect
> the changes, including a number of calls to the layout
> manager to calculate the position of characters and
> setting the frames of a number of subviews in another
> view). I have worked hard on this, so that speed is
> not an issue.
It may be as fast as it can be but if you can work out a method of
running that code less often it'll be even faster.
One possible approach, and I haven't seen the app so I'm not sure if
this makes sense, would be to delay updates with a timer if you detect
the user is really on a roll. You may delay setting the frames of the
subviews, for example, by a tiny amount so that they only update on
every second or third change to the text view. If the user is typing
fast enough a slightly delayed layout of other subviews is unlikely to
bother them. I'd try measuring the number of textDidChange calls a
second, in code, and if it goes beyond a threshold set a timer with a
brief delay that when fired will redo the layout of the subviews. If
the timer is already set don't bother - that way you can coalesce the
changes and do less work in total.
Or, as John says, just either ignore it or add a tip to the
documentation about it. You'd need to know what kind of hardware your
users have and what kind of work flow them expect to be able to decide
if this really is an issue at all.
Take care,
Guy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden