Re: Drawing many different strings quickly
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