DescriptionAvoid resetting the metrics-list/character offset for each text box
SVGTextLayoutEngine::layoutTextOnLineOrPath needs to keep track of the
SVGTextMetrics corresponding to each glyph it layouts. To do this, the
members m_visual{Character,MetricsList}Offset are used. However, this
state is reset for each invocation, which means that finding the
starting metrics entry can yield O(N^2) behavior. For text nodes with
many (logically consecutive) text boxes, this can become noticeable.
Introduce a helper SVGTextMetricsIterator - replacing the m_visual*
members - and let it persist across calls to layoutTextOnLineOrPath.
This speeds up the case of many logically consecutive text boxes.
Using the PerfTestRunner.measurePageLoadTime harness with
separate-x.svg from the bug give the following results locally:
Before: After:
avg 101.5 ms -> 93.1 ms
median 101.1 ms -> 93.1 ms
stdev 2.8 ms -> 2.3 ms
BUG=486669
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=196054
Patch Set 1 #
Total comments: 16
Patch Set 2 : Shake, rattle and roll. #Patch Set 3 : Rebase. #
Messages
Total messages: 10 (3 generated)
|