Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate perf issue with _DWriteGetFrame() #1621

Closed
rajsesh opened this issue Jan 3, 2017 · 2 comments
Closed

Investigate perf issue with _DWriteGetFrame() #1621

rajsesh opened this issue Jan 3, 2017 · 2 comments

Comments

@rajsesh
Copy link
Contributor

rajsesh commented Jan 3, 2017

No description provided.

@ms-jihua
Copy link
Contributor

ms-jihua commented Jan 3, 2017

image

Here's a sample trace from XamlCatalog's custom text view, on top of changes from #1603, and an experimental fix for #1620. When we get deep into the spiral, the view begins to lag. Tracing shows that the primary bottleneck seems to be in drawInRect:, with the time being spent in CFRelease and CGPathRetain sticking out.

image

Uncertain exactly how tractable things under _DWriteGetFrame() itself are. I pointed out a few potential improvements in closing comments for #1374, but for the most part there are no super-egregious bottlenecks.

ms-jihua added a commit to ms-jihua/WinObjC that referenced this issue Jan 4, 2017
Found while checking CTCatalog affine transform test.
In cases of longer strings, _DWriteGetFrame() spends an inordinate amount of time in:
_DWriteGetFrame (~30%) -> [NSString substring...] (~27%) -> [NSString _fastestEncodingWith...] (~25%)  (sample trace)

Changed this function to not call [self length] every iteration, fetch characters in chunks.
After this change, the same test looks like:
_DWriteGetFrame (~5%) -> [NSString substring...] (~1.2%) -> [NSString _fastestEncodingWith...] (~0.5%)  (sample trace)

Related to microsoft#1621
ms-jihua added a commit that referenced this issue Jan 4, 2017
Found while checking CTCatalog affine transform test.
In cases of longer strings, _DWriteGetFrame() spends an inordinate amount of time in:
_DWriteGetFrame (~30%) -> [NSString substring...] (~27%) -> [NSString _fastestEncodingWith...] (~25%)  (sample trace)

Changed this function to not call [self length] every iteration, fetch characters in chunks.
After this change, the same test looks like:
_DWriteGetFrame (~5%) -> [NSString substring...] (~1.2%) -> [NSString _fastestEncodingWith...] (~0.5%)  (sample trace)

Related to #1621
@rajsesh
Copy link
Contributor Author

rajsesh commented Jan 6, 2017

We will revisit other perf bottlenecks when #1620 is completed. This may be entirely gated now on #1490.

@rajsesh rajsesh closed this as completed Jan 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants