• 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: Drawing many different strings quickly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing many different strings quickly


  • Subject: Re: Drawing many different strings quickly
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 01 Oct 2015 08:23:20 -0700


> On Oct 1, 2015, at 12:02 AM, Ben <email@hidden> wrote:
>
> Using NSString's drawInRect:withAttributes: wants a Swift dictionary of attributes. Instruments showed a lot of time spend accessing the elements of this dictionary and converting back to Objective-C land.
> Converting the string to be drawn to an NSAttributedString and adding attributes to it directly before drawing with drawInRect: resulted in string drawing dropping from ~65% of drawRect time to ~50%.

Ah, that's interesting. So just passing a Swift Dictionary to an API that takes an NSDictionary triggers an expensive conversion. Sort of disheartening, at least to me (I spend more time than most of you having to worry about low-level performance issues.)

—Jens
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Re: Drawing many different strings quickly (From: Ben <email@hidden>)

  • Prev by Date: Re: questions on WebView for Mac apps
  • Next by Date: Re: Mac OSX 10.11 and XCode
  • Previous by thread: Re: Drawing many different strings quickly
  • Next by thread: Re: NSTableView - Detecting when user has finished scrolling
  • Index(es):
    • Date
    • Thread