Hi list,

I'm needing to draw somewhere in the order of 1,000,000 different strings in a 
scrollable grid view and am struggling to get performance that I am happy with.

After profiling, most of my time is spent in drawing text into the view.

My first attempt was simply to use NSString's drawInRect:withAttributes:. The 
attributes dictionary was cached between calls. This is not too bad for shorter 
strings, but slows down dramatically once longer strings need to be drawn 
truncated.

My second attempt has been to use my own NSTextStorage/Container/LayoutManager 
trio and draw using NSLayoutManager. This is faster when many strings are the 
same, but worse when most are different. I don't know in advance what the 
strings will be so must assume they are all unique.


Can anyone suggest what I should look into next? My requirements are as follows:

- Assume around a million unique strings to be drawn
- Not all strings to be drawn at once, a scroll view is being used and I am 
using responsive scrolling to pre-draw areas. The problem occurs when quickly 
scrolling a large distance
- Longer strings will be truncated to a single line under 200px wide
- All strings to be drawn in the same font/size/colour
- I can target the current (or current+1) OS version if that makes any 
difference


Any pointers or suggestions gratefully accepted!

- Ben
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to