Re: Dealing with Very Slow NSViews
Re: Dealing with Very Slow NSViews
- Subject: Re: Dealing with Very Slow NSViews
- From: Cameron Hayne <email@hidden>
- Date: Sat, 7 Sep 2002 01:28:39 -0400
On Friday, September 6, 2002, at 06:11 pm, John Nairn wrote:
My Cocoa application is great for interactive graphics when plotting
scientific results. Recently I did some large calculations. While I can
still plot them, the task is too demanding for things like live
scrolling, live window resizing, and continuous controls (for example,
one view had to create, draw, and fill about 200,000 bezier curves). I
am tying to think of ways to improve speed, but also I should implement
things to improve the interface when it must be slow. I had trouble
with my first ideas in Cocoa. Does any one know how to solve such
problems as:
1. I would like to turn off live window resizing. I can then drag to
new size and wait once for redisplay.
You can use the NSView methods viewWillStartLiveResize,
viewDidEndLiveResize, inLiveResize to avoid doing recalcs & redisplay
during window resizing. I use 'inLiveResize' in my sample project
"ImageCalc" which is available at:
http://hayne.net/MacDev/ImageCalc/
2. Similarly, I would like to turn of live scrolling. I can then drag
thumb to new location and let go for one redisplay.
3. Finally, I have a slider that selects from a set of results (each of
which is a large calculation). Currently the slider is continuous. It
is easy to make it not continuous, but I need it half and half. I need
it continuous to give text feedback on which result is about to be
selected, but when it is done I need one last message to actually draw
that plot.
You could set a timer in the slider action and only do the recalc when
the timer expires.
As a more sophisticated extension of this idea, you could do what I've
seen done in a scientific visualization application - have your
calculation & display be parametrized so that you do a very fast & rough
calculation at first (when the slider changes) but then recalculate &
redisplay with more precision once the slider has stopped.
--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.