Bug 157749 - Regression(r177786): GlyphMetricsMap<T>::locatePageSlowCase() fills existing pages with unknown metrics
Summary: Regression(r177786): GlyphMetricsMap<T>::locatePageSlowCase() fills existing ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks: 139971
  Show dependency treegraph
 
Reported: 2016-05-16 13:24 PDT by Chris Dumez
Modified: 2016-05-18 09:03 PDT (History)
5 users (show)

See Also:


Attachments
Patch (5.08 KB, patch)
2016-05-16 13:38 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-05-16 13:24:32 PDT
GlyphMetricsMap<T>::locatePageSlowCase() fills existing pages with unknown metrics after <http://trac.webkit.org/changeset/177786>. Previously, we would only to this for new pages.
Comment 1 Chris Dumez 2016-05-16 13:38:57 PDT
Created attachment 279040 [details]
Patch
Comment 2 Chris Dumez 2016-05-16 13:39:09 PDT
Still testing locally.
Comment 3 Chris Dumez 2016-05-16 13:47:01 PDT
Found this by looking at PLT profiles that seeing that WebCore::GlyphMetricsMap<WebCore::FloatRect>::locatePageSlowCase(unsigned int) is slow.
Comment 4 Antti Koivisto 2016-05-17 11:08:18 PDT
Comment on attachment 279040 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=279040&action=review

Nice find, r=me

> Source/WebCore/platform/graphics/GlyphMetricsMap.h:123
> +    auto& pageInMap = m_pages->add(pageNumber, nullptr).iterator->value;
> +    if (!pageInMap)
> +        pageInMap = std::make_unique<GlyphMetricsPage>(unknownMetrics());
> +    return *pageInMap;

If you want to be fancy you could do something like

return *m_pages.ensure(pageNumber, [] { 
   return std::make_unique<GlyphMetricsPage>(unknownMetrics(); }
).iterator->value;
Comment 5 WebKit Commit Bot 2016-05-17 11:30:06 PDT
Comment on attachment 279040 [details]
Patch

Clearing flags on attachment: 279040

Committed r201023: <http://trac.webkit.org/changeset/201023>
Comment 6 WebKit Commit Bot 2016-05-17 11:30:11 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Chris Dumez 2016-05-18 09:02:17 PDT
Looks like a ~1% PLT progression on Mac.
Comment 8 Chris Dumez 2016-05-18 09:03:45 PDT
(In reply to comment #7)
> Looks like a ~1% PLT progression on Mac.

Ditto on iOS.