• 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: Slow Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Slow Cocoa


  • Subject: Re: Slow Cocoa
  • From: Public Look <email@hidden>
  • Date: Mon, 16 Feb 2004 17:58:51 -0500

In general, allocating and deallocating objects is very expensive. It is all built on top of malloc() and free(), and at least historically, both functions were very slow on Unix systems. How slow ? I don't know. I haven't measured their performance with repeated small allocations and deallocations on Mac OS X. On a particular opensource Unix like system I have been using but won't name, malloc() calls average about a microsecond per call which really adds up... If you need to allocate a 1 million objects per second, you better not be doing anything else on that platform.

Note: even reusing the same NSBezierPath instance may not save allocations because for all we know, NSBezierPath internally allocates and deallocates storage for the paths you create.

On Feb 16, 2004, at 5:39 PM, Tregaskis, Wade wrote:

I am making an app that draws using Quartz. I used to use the C
functions, but then I started using NSBezierPath. When I tried that
everything was slower. I am guessing this is because of the messaging.
Is there a way to "speed up" objc?

First question: are you keeping the bezierpath around, or creating a
new one every time -drawRect: is called?

Off the top of your head, what's the performance difference between creating a new bezier path for each drawing, and keeping one around and manipulating it via transforms or some similar mechanism? Is it a 2x or 3x benefit, or are we talking orders of magnitude?

Wade Tregaskis
_______________________________________________
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.
_______________________________________________
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.

  • Follow-Ups:
    • Re: Slow Cocoa
      • From: Allan Odgaard <email@hidden>
References: 
 >Re: Slow Cocoa (From: "Tregaskis, Wade" <email@hidden>)

  • Prev by Date: Re: NSImage and flipping
  • Next by Date: Re: NSTableView/NSPopUpButtonCell Mysteries
  • Previous by thread: Re: Slow Cocoa
  • Next by thread: Re: Slow Cocoa
  • Index(es):
    • Date
    • Thread