• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Dealing with Very Slow NSViews
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dealing with Very Slow NSViews


  • Subject: Re: Dealing with Very Slow NSViews
  • From: "John C. Randolph" <email@hidden>
  • Date: Fri, 6 Sep 2002 17:06:35 -0700

On Friday, September 6, 2002, at 03: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.

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.

Before you start breaking things like live window resizing and scrolling, I would take a look at optimizing the plotting itself. Are all of these bezier curves visible? If you check the rectangle handed to you in the -drawRect: method and only draw the elements that are within the given area, that can be a pretty big savings for a start. Secondly, are you re-calculating the bezier paths each time -drawRect is called?

If you look at the "Polygons" example at

http://developer.apple.com/samplecode/Sample_Code/Cocoa/Polygons/

you'll note that the code to set up the complicated bezier path is kept separate from the code that draws the path.

-jcr

John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
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.

References: 
 >Dealing with Very Slow NSViews (From: John Nairn <email@hidden>)

  • Prev by Date: Re: Interface Builder Question
  • Next by Date: (More) Re: NSAppleEventDescriptor/AEKeyword question
  • Previous by thread: Dealing with Very Slow NSViews
  • Next by thread: Re: Dealing with Very Slow NSViews
  • Index(es):
    • Date
    • Thread