Changeset 211394 in webkit
- Timestamp:
- Jan 30, 2017 4:17:04 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/PerformanceTests/ChangeLog
r210757 r211394 1 2017-01-30 Zalan Bujtas <zalan@apple.com> 2 3 Simple line layout: Small tweaks to improve performance. 4 https://bugs.webkit.org/show_bug.cgi?id=167611 5 <rdar://problem/30274294> 6 7 Reviewed by Simon Fraser. 8 9 * Layout/simple-line-layout-non-repeating-text.html: Added. 10 1 11 2017-01-13 Said Abou-Hallawa <sabouhallawa@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r211393 r211394 1 2017-01-30 Zalan Bujtas <zalan@apple.com> 2 3 Simple line layout: Small tweaks to improve performance. 4 https://bugs.webkit.org/show_bug.cgi?id=167611 5 <rdar://problem/30274294> 6 7 Reviewed by Simon Fraser. 8 9 This is ~10% progression on the attached test case (paragraphs with non-redundant content). 10 median: 102.08 runs/s -> median: 114.25 runs/s 11 12 * rendering/SimpleLineLayout.cpp: 13 (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded): 14 * rendering/SimpleLineLayoutFlowContents.cpp: 15 (WebCore::SimpleLineLayout::initializeSegments): 16 (WebCore::SimpleLineLayout::FlowContents::FlowContents): 17 * rendering/SimpleLineLayoutFlowContents.h: 18 * rendering/SimpleLineLayoutTextFragmentIterator.cpp: 19 (WebCore::SimpleLineLayout::TextFragmentIterator::nextNonWhitespacePosition): 20 (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition): 21 * rendering/SimpleLineLayoutTextFragmentIterator.h: 22 1 23 2017-01-30 Chris Dumez <cdumez@apple.com> 2 24 -
trunk/Source/WebCore/rendering/SimpleLineLayout.cpp
r211292 r211394 461 461 runs.append(Run(fragment.start(), endPosition, m_runsWidth, m_runsWidth + fragment.width(), false, fragment.hasHyphen())); 462 462 else { 463 constauto& lastFragment = m_fragments.last();463 auto& lastFragment = m_fragments.last(); 464 464 // Advance last completed fragment when the previous fragment is all set (including multiple parts across renderers) 465 465 if ((lastFragment.type() != fragment.type()) || !lastFragment.overlapsToNextRenderer()) … … 562 562 // First character of the first fragment might be forced on to the current line even if it does not fit. 563 563 bool m_firstCharacterFits { false }; 564 Vector<TextFragmentIterator::TextFragment> m_fragments; 564 // FIXME: We don't actually need this for all the simple cases. Try to remove/make it optional. 565 Vector<TextFragmentIterator::TextFragment, 30> m_fragments; 565 566 }; 566 567 -
trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp
r185531 r211394 44 44 segments.reserveCapacity(numberOfChildren); 45 45 unsigned startPosition = 0; 46 for ( constauto& child : childrenOfType<RenderObject>(flow)) {46 for (auto& child : childrenOfType<RenderObject>(flow)) { 47 47 if (is<RenderText>(child)) { 48 constauto& textChild = downcast<RenderText>(child);48 auto& textChild = downcast<RenderText>(child); 49 49 unsigned textLength = textChild.text()->length(); 50 50 segments.append(FlowContents::Segment { startPosition, startPosition + textLength, textChild.text(), textChild }); … … 63 63 FlowContents::FlowContents(const RenderBlockFlow& flow) 64 64 : m_segments(initializeSegments(flow)) 65 , m_lastSegmentIndex(0)66 65 { 67 66 } -
trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h
r211108 r211394 46 46 unsigned start; 47 47 unsigned end; 48 String text;48 StringView text; 49 49 const RenderObject& renderer; 50 50 }; … … 58 58 unsigned segmentIndexForRunSlow(unsigned start, unsigned end) const; 59 59 const Vector<Segment, 8> m_segments; 60 mutable unsigned m_lastSegmentIndex ;60 mutable unsigned m_lastSegmentIndex { 0 }; 61 61 }; 62 62 -
trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp
r211228 r211394 154 154 } 155 155 156 template <typename CharacterType>157 156 unsigned TextFragmentIterator::nextNonWhitespacePosition(const FlowContents::Segment& segment, unsigned startPosition) 158 157 { 159 158 ASSERT(startPosition < segment.end); 160 const auto* text = segment.text.characters<CharacterType>();161 159 unsigned position = startPosition; 162 160 for (; position < segment.end; ++position) { 163 auto character = text[segment.toSegmentPosition(position)];161 auto character = segment.text[segment.toSegmentPosition(position)]; 164 162 bool isWhitespace = character == ' ' || character == '\t' || (!m_style.preserveNewline && character == '\n'); 165 163 if (!isWhitespace) … … 214 212 // Collapsed whitespace has constant width. Do not measure it. 215 213 if (positionType == NonWhitespace) 216 nextPosition = m_currentSegment->text.is8Bit() ? nextNonWhitespacePosition<LChar>(*m_currentSegment, currentPosition) : nextNonWhitespacePosition<UChar>(*m_currentSegment, currentPosition);214 nextPosition = nextNonWhitespacePosition(*m_currentSegment, currentPosition); 217 215 else if (positionType == Breakable) { 218 216 nextPosition = nextBreakablePosition(*m_currentSegment, currentPosition); -
trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h
r211228 r211394 134 134 bool isHardLineBreak(const FlowContents::Iterator& segment) const; 135 135 unsigned nextBreakablePosition(const FlowContents::Segment&, unsigned startPosition); 136 template <typename CharacterType>unsigned nextNonWhitespacePosition(const FlowContents::Segment&, unsigned startPosition);136 unsigned nextNonWhitespacePosition(const FlowContents::Segment&, unsigned startPosition); 137 137 float runWidth(const FlowContents::Segment&, unsigned startPosition, unsigned endPosition, float xPosition) const; 138 138
Note: See TracChangeset
for help on using the changeset viewer.