• 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: Fastest way to push strings to the screen in an NSView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fastest way to push strings to the screen in an NSView?


  • Subject: Re: Fastest way to push strings to the screen in an NSView?
  • From: Douglas Davidson <email@hidden>
  • Date: Wed, 17 Nov 2004 18:39:09 -0800


On Nov 17, 2004, at 6:24 PM, Robbie Haertel wrote:


The drawAtPoint: and drawInRect: methods are designed for drawing
small amounts of text or text that must be drawn rarely. They create
and dispose of various supporting text objects every time you call
them. To draw strings repeatedly, it is more efficient to use
NSLayoutManager, as described in "Drawing Strings".

This isn't necessarily always the case; the drawAtPoint: and drawInRect: methods have been optimized for certain common cases, and continue to be further optimized with each new release. However, they can be called with arbitrary attributed strings--anything from "Hello, world" to a novel--and they certainly cannot be optimized for all cases; in the general case the use of an NSLayoutManager to retain layout information is definitely faster when the same string is drawn more than once. I would recommend moving to the use of a layout manager only if testing shows that the string drawing methods are a bottleneck.


Douglas Davidson

_______________________________________________
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


  • Follow-Ups:
    • Re: Fastest way to push strings to the screen in an NSView?
      • From: Robbie Haertel <email@hidden>
References: 
 >Fastest way to push strings to the screen in an NSView? (From: Scott Ellsworth <email@hidden>)
 >Re: Fastest way to push strings to the screen in an NSView? (From: Robbie Haertel <email@hidden>)

  • Prev by Date: Re: Fastest way to push strings to the screen in an NSView?
  • Next by Date: Re: Precompiled headers failing to build
  • Previous by thread: Re: Fastest way to push strings to the screen in an NSView?
  • Next by thread: Re: Fastest way to push strings to the screen in an NSView?
  • Index(es):
    • Date
    • Thread