RESOLVED FIXED 161119
[Cocoa] Improve performance of glyph advance metrics gathering
https://bugs.webkit.org/show_bug.cgi?id=161119
Summary [Cocoa] Improve performance of glyph advance metrics gathering
Myles C. Maxfield
Reported 2016-08-23 17:05:11 PDT
[Cocoa] Improve performance of glyph advance metrics gathering
Attachments
WIP (15.58 KB, patch)
2016-08-23 17:07 PDT, Myles C. Maxfield
no flags
WIP (31.98 KB, patch)
2016-08-23 19:36 PDT, Myles C. Maxfield
no flags
WIP (33.33 KB, patch)
2016-08-23 20:28 PDT, Myles C. Maxfield
no flags
Perf Measurements (244.07 KB, image/png)
2016-08-25 13:41 PDT, Myles C. Maxfield
no flags
Perf measurements - excluding glyph counts of > 256 (180.88 KB, image/png)
2016-08-25 13:43 PDT, Myles C. Maxfield
no flags
Y-Intercept zoom (38.05 KB, image/png)
2016-08-25 13:54 PDT, Myles C. Maxfield
no flags
Get glyphs from characters (347.37 KB, image/png)
2016-08-25 14:02 PDT, Myles C. Maxfield
no flags
Y intercept for getting glyphs from characters (93.58 KB, image/png)
2016-08-25 14:06 PDT, Myles C. Maxfield
no flags
WIP (41.63 KB, patch)
2016-08-25 17:05 PDT, Myles C. Maxfield
no flags
WIP (41.81 KB, patch)
2016-08-25 17:23 PDT, Myles C. Maxfield
no flags
WIP (40.09 KB, patch)
2016-08-26 02:20 PDT, Myles C. Maxfield
no flags
WIP (39.20 KB, patch)
2016-08-26 10:21 PDT, Myles C. Maxfield
no flags
WIP (39.20 KB, patch)
2016-08-26 11:00 PDT, Myles C. Maxfield
no flags
WIP (39.94 KB, patch)
2016-08-27 14:42 PDT, Myles C. Maxfield
no flags
WIP (19.17 KB, patch)
2016-09-04 15:02 PDT, Myles C. Maxfield
no flags
Testing CoreText (1.73 KB, patch)
2016-09-07 12:26 PDT, Myles C. Maxfield
no flags
Using CoreText measurements (3.44 KB, patch)
2016-09-07 14:08 PDT, Myles C. Maxfield
no flags
platformWidthForGlyph (3.76 KB, patch)
2016-09-07 17:14 PDT, Myles C. Maxfield
no flags
GlyphPage size (9.81 KB, patch)
2016-09-07 19:06 PDT, Myles C. Maxfield
buildbot: commit-queue-
Archive of layout-test-results from ews103 for mac-yosemite (1.66 MB, application/zip)
2016-09-07 20:07 PDT, Build Bot
no flags
Archive of layout-test-results from ews104 for mac-yosemite-wk2 (1.72 MB, application/zip)
2016-09-07 20:09 PDT, Build Bot
no flags
Archive of layout-test-results from ews114 for mac-yosemite (2.31 MB, application/zip)
2016-09-07 20:11 PDT, Build Bot
no flags
GlyphPage size (9.61 KB, patch)
2016-09-08 11:03 PDT, Myles C. Maxfield
buildbot: commit-queue-
Archive of layout-test-results from ews112 for mac-yosemite (2.47 MB, application/zip)
2016-09-08 11:57 PDT, Build Bot
no flags
Archive of layout-test-results from ews106 for mac-yosemite-wk2 (2.26 MB, application/zip)
2016-09-08 12:04 PDT, Build Bot
no flags
Archive of layout-test-results from ews102 for mac-yosemite (1.66 MB, application/zip)
2016-09-08 12:09 PDT, Build Bot
no flags
Archive of layout-test-results from ews123 for ios-simulator-elcapitan-wk2 (16.59 MB, application/zip)
2016-09-08 12:15 PDT, Build Bot
no flags
GlyphPage size (9.89 KB, patch)
2016-09-08 14:01 PDT, Myles C. Maxfield
no flags
Patch (14.28 KB, patch)
2016-09-08 14:54 PDT, Myles C. Maxfield
no flags
Patch (15.95 KB, patch)
2016-09-08 15:43 PDT, Myles C. Maxfield
no flags
Patch (18.98 KB, patch)
2016-09-08 17:21 PDT, Myles C. Maxfield
simon.fraser: review+
Patch for committing (19.08 KB, patch)
2016-09-08 17:39 PDT, Myles C. Maxfield
commit-queue: commit-queue-
Patch for committing (19.12 KB, patch)
2016-09-09 01:00 PDT, Myles C. Maxfield
no flags
Patch for committing (19.53 KB, patch)
2016-09-09 01:02 PDT, Myles C. Maxfield
no flags
Myles C. Maxfield
Comment 1 2016-08-23 17:07:16 PDT
Myles C. Maxfield
Comment 2 2016-08-23 19:36:09 PDT
Myles C. Maxfield
Comment 3 2016-08-23 20:28:01 PDT
WebKit Commit Bot
Comment 4 2016-08-24 10:33:56 PDT
Attachment 286828 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 10 files If any of these errors are false positives, please file a bug against check-webkit-style.
Myles C. Maxfield
Comment 5 2016-08-24 20:37:11 PDT
This patch makes PLT worse by 0.46%.
Myles C. Maxfield
Comment 6 2016-08-25 13:41:03 PDT
Created attachment 287002 [details] Perf Measurements Current CG and CT APIs for measuring width allow you to specify multiple glyphs at once. I measured the runtime of measuring increasingly large numbers of glyphs, and you can see that the relationship is linear with a y-intercept of 0. This means that calling the function twice with half the number of glyphs has the same runtime cost as running the function once with the full set of glyphs. Therefore, batching the glyphs up into fewer calls has no runtime gain.
Myles C. Maxfield
Comment 7 2016-08-25 13:43:44 PDT
Created attachment 287003 [details] Perf measurements - excluding glyph counts of > 256 If you exclude the data points that we will obviously never use (because they're too big) you can see the y-intercept isn't actually 0.
Myles C. Maxfield
Comment 8 2016-08-25 13:54:33 PDT
Created attachment 287008 [details] Y-Intercept zoom You can see that the y intercept is about 8 times bigger than the slope, which means we want at most 8 unused measurements per call. Any more unused measurements, and it would be cheaper just to make a new call. (However, this logic assumes that all the 8 unused measurements can be gathered in a single call.) This data seems to indicate that we would still benefit from aggregation, but only if the group size is on the order of 8 glyphs.
Myles C. Maxfield
Comment 9 2016-08-25 14:02:15 PDT
Created attachment 287012 [details] Get glyphs from characters For fun, here is the similar graph for getting glyphs from characters.
Myles C. Maxfield
Comment 10 2016-08-25 14:06:24 PDT
Created attachment 287013 [details] Y intercept for getting glyphs from characters For getting glyphs from characters, the Y-intercept is about 5 times as big as the slope
Myles C. Maxfield
Comment 11 2016-08-25 14:10:51 PDT
This line of investigation needs to consider: 1) The hit rate of the current cache. 2) The number of glyphs / advances which are gathered but never used
Myles C. Maxfield
Comment 12 2016-08-25 15:03:23 PDT
Only 6.55% of the character -> glyph mappings we populate our GlyphPages with are ever actually read. This seems to indicate the glyph page size is way too big.
Myles C. Maxfield
Comment 13 2016-08-25 15:09:20 PDT
(In reply to comment #12) > Only 6.55% of the character -> glyph mappings we populate our GlyphPages > with are ever actually read. > > This seems to indicate the glyph page size is way too big. Decreasing the glyph page size to 16 boosts this up to 25%. Decreasing the glyph page size to 8 boosts this up to 36%. (And, of course, decreasing the glyph page size to 1 boosts this up to 100%.)
Myles C. Maxfield
Comment 14 2016-08-25 15:16:33 PDT
(In reply to comment #13) > (In reply to comment #12) > > Only 6.55% of the character -> glyph mappings we populate our GlyphPages > > with are ever actually read. > > > > This seems to indicate the glyph page size is way too big. > > Decreasing the glyph page size to 16 boosts this up to 25%. > > Decreasing the glyph page size to 8 boosts this up to 36%. > > (And, of course, decreasing the glyph page size to 1 boosts this up to 100%.) Similarly, With the current glyph page size, we populate 715 pages. Decreasing the glyph page size to 16 makes us create 2879 pages. Decreasing the glyph page size to 8 makes us create 4181 pages.
Myles C. Maxfield
Comment 15 2016-08-25 15:26:24 PDT
Decreasing the glyph page size from 256 to 16 causes: 2164 more glyph pages to be created (and therefore 2164 more calls to map characters to glyphs) but, we then avoid creating 136976 unread mappings. Given that one call is roughly the cost of creating an additional 5 mappings, this should definitely be a win. This is actually a memory win too, because we'll be creating fewer glyph pages to remember.
Myles C. Maxfield
Comment 16 2016-08-25 17:05:26 PDT
Myles C. Maxfield
Comment 17 2016-08-25 17:23:48 PDT
Myles C. Maxfield
Comment 18 2016-08-26 02:20:11 PDT
Myles C. Maxfield
Comment 19 2016-08-26 10:21:46 PDT
Myles C. Maxfield
Comment 20 2016-08-26 11:00:35 PDT
Myles C. Maxfield
Comment 21 2016-08-27 13:58:47 PDT
This latest patch causes PLT to improve.
Myles C. Maxfield
Comment 22 2016-08-27 14:42:44 PDT
Myles C. Maxfield
Comment 23 2016-08-28 00:00:04 PDT
+css3/font-variant-all.html reference images diff (0.47%) image pass history +fast/css/font-face-multiple-faces.html expected actual diff pretty diff images diff (3.28%) text image+text pass history +fast/css/font-face-synthetic-bold-italic.html expected actual diff pretty diff images diff (1.36%) text image+text pass history +fast/css/font-face-weight-matching.html expected actual diff pretty diff images diff (1.11%) text image+text pass history +fast/text/arabic-zwj-and-zwnj.html reference images diff (0.04%) image pass history +fast/text/atsui-multiple-renderers.html expected actual diff pretty diff images diff (2.82%) text image+text pass history +fast/text/complex-initial-advance.html reference images diff (0.05%) image pass history +fast/text/complex-synthetic-bold-space-width.html expected actual diff pretty diff images diff (0.2%) text image+text pass history +fast/text/drawBidiText.html expected actual diff pretty diff images diff (1.77%) text image+text pass history +fast/text/emoji-num-glyphs.html timeout fail fail history +fast/text/font-size-zero.html expected actual diff pretty diff text pass history +fast/text/font-weights-zh.html expected actual diff pretty diff images diff (0.14%) text image+text pass history +fast/text/format-control.html expected actual diff pretty diff images diff (1.42%) text image+text pass history +fast/text/hyphenate-avoid-orphaned-word.html expected actual diff pretty diff images text missing history +fast/text/hyphenate-character.html expected actual diff pretty diff images diff (5.8%) text image+text pass history +fast/text/hyphenate-first-word.html expected actual diff pretty diff images diff (0.29%) text image+text pass history +fast/text/hyphenate-limit-lines.html expected actual diff pretty diff images diff (4.04%) text image+text pass history +fast/text/hyphenate-locale.html expected actual diff pretty diff images diff (0.86%) text image+text pass history +fast/text/hyphens.html expected actual diff pretty diff images diff (5.41%) text image+text pass history +fast/text/line-initial-and-final-swashes.html expected actual diff pretty diff images diff (3.22%) text image+text pass history +fast/text/multiple-feature-properties.html reference images diff (0.09%) image pass history +fast/text/narrow-non-breaking-space.html reference images diff (0.01%) image pass history +fast/text/wide-zero-width-space.html expected actual diff pretty diff images diff (1.09%) text image+text pass history +fast/text/zero-font-size.html expected actual diff pretty diff images diff (0.82%) text image+text pass history +fast/text/zero-sized-fonts.html expected actual diff pretty diff text pass history +fast/writing-mode/broken-ideographic-font.html expected actual diff pretty diff images diff (0.5%) text image+text pass history +fast/writing-mode/japanese-rl-text-with-broken-font.html expected actual diff pretty diff images diff (5.95%) text image+text pass history +fonts/cursive.html expected actual diff pretty diff images diff (0.73%) text image+text pass history +fonts/fantasy.html expected actual diff pretty diff images diff (0.79%) text image+text pass history +fonts/monospace.html expected actual diff pretty diff images diff (7.21%) text image+text pass history +imported/blink/fast/text/international/text-shaping-arabic.html reference images diff (0.01%) image pass history +imported/w3c/web-platform-tests/html/dom/elements/global-attributes/dir_auto-textarea-mixed.html reference images diff (0.19%) image pass history +imported/w3c/web-platform-tests/html/dom/elements/global-attributes/dir_auto-textarea-script-mixed.html reference images diff (0.19%) image pass history +mathml/opentype/munderover-layout-resize.html reference images diff (0.29%) image pass history +platform/mac/fast/text/international/Geeza-Pro-vertical-metrics-adjustment.html expected actual diff pretty diff images diff (4.66%) text image+text pass history +svg/W3C-SVG-1.1-SE/filters-image-03-f.svg expected actual diff pretty diff images diff (0.43%) text image+text pass history +svg/W3C-SVG-1.1-SE/paths-dom-02-f.svg expected actual diff pretty diff images diff (0.26%) text image+text pass history +svg/W3C-SVG-1.1-SE/pservers-pattern-03-f.svg expected actual diff pretty diff images diff (0.24%) text image+text pass history +svg/W3C-SVG-1.1-SE/struct-use-14-f.svg expected actual diff pretty diff images diff (0.26%) text image+text pass history +svg/W3C-SVG-1.1-SE/svgdom-over-01-f.svg expected actual diff pretty diff images diff (1.42%) text image+text pass history +svg/W3C-SVG-1.1/fonts-glyph-02-t.svg expected actual diff pretty diff images diff (2.94%) text image+text pass history +svg/W3C-SVG-1.1/interact-cursor-01-f.svg expected actual diff pretty diff images diff (1.89%) text image+text pass history +svg/custom/glyph-selection-arabic-forms.svg expected actual diff pretty diff images diff (0.2%) text image+text pass history +svg/custom/svg-fonts-fallback.xhtml expected actual diff pretty diff images diff (0.6%) text image+text pass history +svg/text/font-size-below-point-five.svg expected actual diff pretty diff images diff (0.37%) text image+text pass history
Myles C. Maxfield
Comment 24 2016-09-04 15:02:45 PDT
Myles C. Maxfield
Comment 25 2016-09-07 12:26:33 PDT
Created attachment 288169 [details] Testing CoreText
Myles C. Maxfield
Comment 26 2016-09-07 14:08:22 PDT
Created attachment 288183 [details] Using CoreText measurements
Myles C. Maxfield
Comment 27 2016-09-07 17:14:36 PDT
Created attachment 288210 [details] platformWidthForGlyph
Myles C. Maxfield
Comment 28 2016-09-07 19:06:19 PDT
Created attachment 288223 [details] GlyphPage size
WebKit Commit Bot
Comment 29 2016-09-07 19:08:17 PDT
Attachment 288223 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Build Bot
Comment 30 2016-09-07 20:07:38 PDT
Comment on attachment 288223 [details] GlyphPage size Attachment 288223 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2030099 New failing tests: svg/W3C-SVG-1.1/fonts-glyph-02-t.svg imported/blink/fast/text/international/text-shaping-arabic.html fast/text/multiple-feature-properties.html fast/text/arabic-zwj-and-zwnj.html svg/custom/svg-fonts-fallback.xhtml css3/font-variant-all.html fast/text/complex-initial-advance.html svg/custom/glyph-selection-arabic-forms.svg mathml/presentation/non-bmp-operators-stretching.html platform/mac/fast/text/international/Geeza-Pro-vertical-metrics-adjustment.html
Build Bot
Comment 31 2016-09-07 20:07:43 PDT
Created attachment 288228 [details] Archive of layout-test-results from ews103 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 32 2016-09-07 20:09:05 PDT
Comment on attachment 288223 [details] GlyphPage size Attachment 288223 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2030109 New failing tests: svg/W3C-SVG-1.1/fonts-glyph-02-t.svg imported/blink/fast/text/international/text-shaping-arabic.html fast/text/multiple-feature-properties.html fast/text/arabic-zwj-and-zwnj.html svg/custom/svg-fonts-fallback.xhtml css3/font-variant-all.html fast/text/complex-initial-advance.html svg/custom/glyph-selection-arabic-forms.svg mathml/presentation/non-bmp-operators-stretching.html platform/mac/fast/text/international/Geeza-Pro-vertical-metrics-adjustment.html
Build Bot
Comment 33 2016-09-07 20:09:09 PDT
Created attachment 288230 [details] Archive of layout-test-results from ews104 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 34 2016-09-07 20:11:30 PDT
Comment on attachment 288223 [details] GlyphPage size Attachment 288223 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/2030105 New failing tests: svg/W3C-SVG-1.1/fonts-glyph-02-t.svg imported/blink/fast/text/international/text-shaping-arabic.html fast/text/multiple-feature-properties.html fast/text/arabic-zwj-and-zwnj.html svg/custom/svg-fonts-fallback.xhtml css3/font-variant-all.html fast/text/complex-initial-advance.html svg/custom/glyph-selection-arabic-forms.svg mathml/presentation/non-bmp-operators-stretching.html platform/mac/fast/text/international/Geeza-Pro-vertical-metrics-adjustment.html
Build Bot
Comment 35 2016-09-07 20:11:34 PDT
Created attachment 288231 [details] Archive of layout-test-results from ews114 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-yosemite Platform: Mac OS X 10.10.5
Myles C. Maxfield
Comment 36 2016-09-08 11:03:46 PDT
Created attachment 288282 [details] GlyphPage size
WebKit Commit Bot
Comment 37 2016-09-08 11:06:43 PDT
Attachment 288282 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Build Bot
Comment 38 2016-09-08 11:57:40 PDT
Comment on attachment 288282 [details] GlyphPage size Attachment 288282 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/2035570 New failing tests: svg/W3C-SVG-1.1/fonts-glyph-02-t.svg imported/blink/fast/text/international/text-shaping-arabic.html mathml/presentation/non-bmp-operators-stretching.html svg/custom/svg-fonts-fallback.xhtml fast/text/arabic-zwj-and-zwnj.html fast/text/multiple-feature-properties.html css3/font-variant-all.html fast/text/complex-initial-advance.html svg/custom/glyph-selection-arabic-forms.svg platform/mac/fast/text/international/Geeza-Pro-vertical-metrics-adjustment.html
Build Bot
Comment 39 2016-09-08 11:57:46 PDT
Created attachment 288293 [details] Archive of layout-test-results from ews112 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews112 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 40 2016-09-08 12:04:18 PDT
Comment on attachment 288282 [details] GlyphPage size Attachment 288282 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2035642 New failing tests: svg/W3C-SVG-1.1/fonts-glyph-02-t.svg imported/blink/fast/text/international/text-shaping-arabic.html fast/text/multiple-feature-properties.html fast/text/arabic-zwj-and-zwnj.html svg/custom/svg-fonts-fallback.xhtml css3/font-variant-all.html fast/text/complex-initial-advance.html svg/custom/glyph-selection-arabic-forms.svg mathml/presentation/non-bmp-operators-stretching.html platform/mac/fast/text/international/Geeza-Pro-vertical-metrics-adjustment.html
Build Bot
Comment 41 2016-09-08 12:04:23 PDT
Created attachment 288295 [details] Archive of layout-test-results from ews106 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 42 2016-09-08 12:09:31 PDT
Comment on attachment 288282 [details] GlyphPage size Attachment 288282 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2035666 New failing tests: svg/W3C-SVG-1.1/fonts-glyph-02-t.svg imported/blink/fast/text/international/text-shaping-arabic.html fast/text/multiple-feature-properties.html fast/text/arabic-zwj-and-zwnj.html svg/custom/svg-fonts-fallback.xhtml css3/font-variant-all.html fast/text/complex-initial-advance.html svg/custom/glyph-selection-arabic-forms.svg mathml/presentation/non-bmp-operators-stretching.html platform/mac/fast/text/international/Geeza-Pro-vertical-metrics-adjustment.html
Build Bot
Comment 43 2016-09-08 12:09:35 PDT
Created attachment 288297 [details] Archive of layout-test-results from ews102 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 44 2016-09-08 12:15:13 PDT
Comment on attachment 288282 [details] GlyphPage size Attachment 288282 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/2035646 New failing tests: svg/W3C-SVG-1.1/fonts-glyph-02-t.svg fast/text/arabic-zwj-and-zwnj.html fast/text/international/arabic-tatweel-join.html svg/custom/glyph-selection-arabic-forms.svg fast/text/complex-initial-advance.html mathml/presentation/non-bmp-operators-stretching.html
Build Bot
Comment 45 2016-09-08 12:15:19 PDT
Created attachment 288299 [details] Archive of layout-test-results from ews123 for ios-simulator-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews123 Port: ios-simulator-elcapitan-wk2 Platform: Mac OS X 10.11.5
Myles C. Maxfield
Comment 46 2016-09-08 14:01:58 PDT
Created attachment 288319 [details] GlyphPage size
WebKit Commit Bot
Comment 47 2016-09-08 14:04:43 PDT
Attachment 288319 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Myles C. Maxfield
Comment 48 2016-09-08 14:54:00 PDT
Simon Fraser (smfr)
Comment 49 2016-09-08 14:58:03 PDT
Comment on attachment 288330 [details] Patch 0' / GlyphPage::size everywhere. That should be wrapped in pageIndexForGlyph() or something.
Myles C. Maxfield
Comment 50 2016-09-08 15:43:52 PDT
Simon Fraser (smfr)
Comment 51 2016-09-08 15:52:43 PDT
Comment on attachment 288343 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=288343&action=review > Source/WebCore/platform/graphics/Font.cpp:155 > + if (pageNumber >= 0x60 && pageNumber < 0x70 && font.shouldNotBeUsedForArabic()) Isn't his making assumptions about page size? Shouldn't you use pageNumberForCharacter() here? Also would prefer pageIndexForCharacter everywhere. > Source/WebCore/platform/graphics/Font.cpp:186 > + } else if (pageNumber == 1) { > + // Control characters must not render at all. > + for (unsigned i = 0; i < 0x10; ++i) > + buffer[i] = zeroWidthSpace; > + } else if (start == (0x7F & ~(GlyphPage::size - 1))) { > + buffer[0x7F - start] = zeroWidthSpace; > + } else if (pageNumber >= 8 && pageNumber < 10) { > + for (unsigned i = 0; i < GlyphPage::size; ++i) > + buffer[i] = zeroWidthSpace; > + } else if (pageNumber == 10) { > + buffer[softHyphen - start] = zeroWidthSpace; I think you could write all this code in terms of glyphIndex % pageSize. Or hide that in a function that would allow you to support a larger first page in future. > Source/WebCore/platform/graphics/FontCascadeFonts.cpp:431 > + const unsigned pageNumber = GlyphPage::pageNumberForCharacter(c); pageIndex > Source/WebCore/platform/graphics/GlyphMetricsMap.h:57 > + static const size_t size = 16; Should you static assert the this is the same as GlyphPage::size? > Source/WebCore/platform/graphics/cocoa/FontCocoa.mm:639 > + CGFontRenderingStyle style = kCGFontRenderingStyleAntialiasing | kCGFontRenderingStyleSubpixelPositioning | kCGFontRenderingStyleSubpixelQuantization | kCGFontAntialiasingStyleUnfiltered; > + > +#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) > + if (platformData().size()) { > + CTFontOrientation orientation = horizontal || m_isBrokenIdeographFallback ? kCTFontOrientationHorizontal : kCTFontOrientationVertical; > + // FIXME: Remove this special-casing when <rdar://problem/28197291> is fixed. > + if (CTFontIsAppleColorEmoji(m_platformData.ctFont())) > + CTFontGetAdvancesForGlyphs(m_platformData.ctFont(), orientation, &glyph, &advance, 1); > + else > + CTFontGetUnsummedAdvancesForGlyphsAndStyle(m_platformData.ctFont(), orientation, style, &glyph, &advance, 1); > + } > + > +#else This seems unrelated.
Myles C. Maxfield
Comment 52 2016-09-08 17:09:27 PDT
Comment on attachment 288343 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=288343&action=review >> Source/WebCore/platform/graphics/GlyphMetricsMap.h:57 >> + static const size_t size = 16; > > Should you static assert the this is the same as GlyphPage::size? It doesn't have to be the same. Reducing this size is a memory win (because most of the entries in GlyphMetricsPages are unread). >> Source/WebCore/platform/graphics/cocoa/FontCocoa.mm:639 >> +#else > > This seems unrelated. This is part of the performance improvements.
Myles C. Maxfield
Comment 53 2016-09-08 17:21:54 PDT
Simon Fraser (smfr)
Comment 54 2016-09-08 17:32:15 PDT
Comment on attachment 288365 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=288365&action=review > Source/WebCore/platform/graphics/GlyphPage.h:81 > + static bool pageNumberIsUsedForArabic(unsigned pageNumber) { return pageNumber >= 0x60 && pageNumber < 0x70; } Still have assumptions about page size here.
Myles C. Maxfield
Comment 55 2016-09-08 17:39:07 PDT
Created attachment 288368 [details] Patch for committing
WebKit Commit Bot
Comment 56 2016-09-08 17:48:03 PDT
Comment on attachment 288368 [details] Patch for committing Rejecting attachment 288368 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'validate-changelog', '--check-oops', '--non-interactive', 288368, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit ChangeLog entry in Source/WebCore/ChangeLog contains OOPS!. Full output: http://webkit-queues.webkit.org/results/2037790
Myles C. Maxfield
Comment 57 2016-09-09 01:00:54 PDT
Created attachment 288392 [details] Patch for committing
Myles C. Maxfield
Comment 58 2016-09-09 01:02:09 PDT
Created attachment 288393 [details] Patch for committing
WebKit Commit Bot
Comment 59 2016-09-09 01:35:45 PDT
Comment on attachment 288393 [details] Patch for committing Clearing flags on attachment: 288393 Committed r205703: <http://trac.webkit.org/changeset/205703>
Tim Nguyen (:ntim)
Comment 60 2024-02-25 19:19:37 PST
*** Bug 152293 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.