I'm seeing very poor performance when programmatically scrolling an NSTextView under certain conditions.
The text view is scaled using [NSView scaleUnitSquareToSize:], and the scroll amounts are fractional (I need to exactly match the appearance of a smaller text view that is also being scrolled). In most cases, performance is fine, but when the the number of characters is small (e.g. the first line contains a - i, separated by spaces), I see very poor performance when text is just leaving the top, or just entering the bottom of the text view. It's so noticeable that you can see the text speed up when the characters start to overlap, and then speed up when the interval between lines reaches one of the edges. When only the top or bottom overlaps, performance is fine, and when the number of characters per line is greater (e.g. a-o), performance is fine too. Using the CPU Sampler template in Instruments clearly shows the performance slow down - the CPU graph is clearly saw-toothed in the pathological case, and flat and much lower in the non-pathological cases. In the peaks, most 70% of CPU is spent in CGSScanConvolveAndIntegrateRGB, at the bottom of the following stack trace: CGSScanConvolveAndIntegrateRGB CGSScanConverterRendermask glyph_path_end CGFontGetGlyphPaths CGFontCreateGlyphBitmaps32 CGFontCreateGlyphBitmaps create_missing_bitmaps CGGlyphLockLockGlyphBitmaps ripc_RenderGlyphs ripc_DrawGlyphs draw_glyphs CGContextShowGlyphsWithAdvances -[NSLayoutManager(NSTextViewSupport) showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment:] Can anyone shed any light on this, or how I might avoid it? What's weird, is that I only get the problem when the number of characters per line is small ... -- http://www.mildmanneredindustries.com/ _______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com