poor performance when scrolling scaled text view, with small number of characters per line only
poor performance when scrolling scaled text view, with small number of characters per line only
- Subject: poor performance when scrolling scaled text view, with small number of characters per line only
- From: Martin Redington <email@hidden>
- Date: Wed, 30 Sep 2009 20:28:01 +0100
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 (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