New issue
Advanced search Search tips

Issue 900015 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 9
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Task



Sign in to add a comment

[LayoutNG] Avoid copying ShapeResults during line breaking

Project Member Reported by e...@chromium.org, Oct 29

Issue description

Currently during line breaking shape results are copied for each line, this wastes memory and is computationally expensive.

 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 31

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a365a8203ccd76f674a28c6633a67433ba0ccb5b

commit a365a8203ccd76f674a28c6633a67433ba0ccb5b
Author: Emil A Eklund <eae@chromium.org>
Date: Wed Oct 31 17:50:08 2018

Introduce ShapeResultView to avoid copies

Introduce a new ShapeResultView class representing a read-only view into
one or more ShapeResults. Will be used instead of ShapeResult::CopyRange
in line breaking to avoid the extra memory and computational overhead of
creating a copy. Switches the ShapeResult::runs_ vector to ref count the
RunInfo instances to allow a ShapeResultView to outline the ShapeResult.

Bug:  900015 
Test: renderer/platform/fonts/shaping/shape_result_view_test.cc
Change-Id: Id676b08a3f03c392ed4271af2f66c51a9e0b2ff6
Reviewed-on: https://chromium-review.googlesource.com/c/1306637
Commit-Queue: Emil A Eklund <eae@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604321}
[modify] https://crrev.com/a365a8203ccd76f674a28c6633a67433ba0ccb5b/third_party/blink/renderer/platform/BUILD.gn
[add] https://crrev.com/a365a8203ccd76f674a28c6633a67433ba0ccb5b/third_party/blink/renderer/platform/fonts/shaping/glyph_bounds_accumulator.h
[modify] https://crrev.com/a365a8203ccd76f674a28c6633a67433ba0ccb5b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc
[modify] https://crrev.com/a365a8203ccd76f674a28c6633a67433ba0ccb5b/third_party/blink/renderer/platform/fonts/shaping/shape_result.cc
[modify] https://crrev.com/a365a8203ccd76f674a28c6633a67433ba0ccb5b/third_party/blink/renderer/platform/fonts/shaping/shape_result.h
[modify] https://crrev.com/a365a8203ccd76f674a28c6633a67433ba0ccb5b/third_party/blink/renderer/platform/fonts/shaping/shape_result_inline_headers.h
[add] https://crrev.com/a365a8203ccd76f674a28c6633a67433ba0ccb5b/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.cc
[add] https://crrev.com/a365a8203ccd76f674a28c6633a67433ba0ccb5b/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h
[add] https://crrev.com/a365a8203ccd76f674a28c6633a67433ba0ccb5b/third_party/blink/renderer/platform/fonts/shaping/shape_result_view_test.cc

📍 Job complete. See results below.
https://pinpoint-dot-chromeperf.appspot.com/job/14875073e40000
📍 Job complete. See results below.
https://pinpoint-dot-chromeperf.appspot.com/job/14b61e8de40000
😿 Pinpoint job stopped with an error.
https://pinpoint-dot-chromeperf.appspot.com/job/12e14827e40000

All of the runs failed. The most common error (20/20 runs) was:
BrowserFinderException: Cannot find browser of type android-chromium. 
Project Member

Comment 8 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c40d032a59f1f00022bc07dc4c4d6cc6986d6069

commit c40d032a59f1f00022bc07dc4c4d6cc6986d6069
Author: Emil A Eklund <eae@chromium.org>
Date: Fri Nov 09 02:22:14 2018

[LayoutNG] Optimize line breaking

Change line brekaing in LayoutNG to create ShapeResultView instances for
each line where the view shares the underlying glyph information structs
with the shape result for the paragraph. Previously that information was
copied instead. Avoiding the copy reduces memory usage and improves perf
by up to 25% for the inline blink_perf.layout benchmarks cross-platform.

To speed up bounding box computation for lines the left and right bounds
for each glyph is retained as part of the HarfBuzzRunGlyphData struct in
ShapeResult::RunInfo. This increases the size by 32-bits per glyph which
is more than offset by the memory reduction from sharing RunInfo objects
for LayoutNG. For legacy layout the impact of the increase is minimal as
the number of individual ShapeResults is kept low due to the word cache.

Bug:  900015 
Test: renderer/platform/fonts/shaping/shaping_line_breaker_test.cc
Change-Id: Ia7c7d72bc1804d8302d26d09a846c4440faef90f
Reviewed-on: https://chromium-review.googlesource.com/c/1313831
Commit-Queue: Emil A Eklund <eae@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606698}
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/TestExpectations
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/squashing/selection-repaint-with-gaps-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/bugzilla-6278-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/flexbox/repaint-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/line-flow-with-floats-1-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/line-flow-with-floats-10-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/line-flow-with-floats-2-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/line-flow-with-floats-3-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/line-flow-with-floats-4-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/line-flow-with-floats-5-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/line-flow-with-floats-6-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/line-flow-with-floats-7-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/line-flow-with-floats-8-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/line-flow-with-floats-9-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/overflow/line-overflow-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/paint/invalidation/text-append-dirty-lines-expected.txt
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/css/threaded/font_object_threaded_test.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/editing/layout_selection.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/inspector/inspector_css_agent.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_abstract_inline_text_box.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_inline_box_state.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_inline_box_state.h
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item_result.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_inline_item_result.h
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.h
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker_test.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_line_truncator.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_physical_text_fragment.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_physical_text_fragment.h
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_physical_text_fragment_test.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_text_fragment_builder.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/inline/ng_text_fragment_builder.h
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/ng_text_fragment_paint_info.h
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper_test.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/shaping/shape_result.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/shaping/shape_result.h
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/shaping/shape_result_bloberizer.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/shaping/shape_result_bloberizer.h
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/shaping/shape_result_inline_headers.h
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/shaping/shape_result_view_test.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.h
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker_test.cc
[modify] https://crrev.com/c40d032a59f1f00022bc07dc4c4d6cc6986d6069/third_party/blink/renderer/platform/testing/shaping_line_breaker_perf_test.cc

Status: Fixed (was: Started)

Sign in to add a comment