Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Issue 1604783002: ALL-IN-ONE: Optimization to previousBoundary() and nextBoundary() (Closed)

Created:
4 years, 11 months ago by Xiaocheng
Modified:
4 years, 10 months ago
Reviewers:
yosin_UTC9
CC:
blink-reviews, chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@progressive_accumulator
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Optimization to previousBoundary() and nextBoundary() This is an all-in-one patch only for reference purposes. It will be split into the following parts for review: 1. Add |characterAt()| to |TextIterator| (landed). 2. Make sure |TextIterator| and |SimplifiedBackwardsTextIterator| always copy whole code points (at least on well-formed UTF-16) (landed). 3. Introduce the |TextBuffer<Direction>| class for efficiently concatenating text extracted from text iterators. Specifically, - |TextBuffer<TextBufferForwards>| performs appendings efficiently - |TextBuffer<TextBufferBackwards>| performs prependings efficiently The class is implemented as a wrapper of |WTF::Vector|. 4. Detemplatize |copyTextTo()|, fixing its output type as |TextBuffer|. 5. Introduce the |TextAccumulator<Buffer>| class, which wraps |TextBuffer| and handles text accumulation progressively. The purpose is to prevent swallowing a huge text node all at once. 6. Optimize |previousBoundary()| and |nextBoundary()| with |TextAccumulator|. (7. Search for some other places where applying |TextAccumulator| improves performance.) BUG=109587

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Total comments: 6

Patch Set 4 : #

Total comments: 1

Patch Set 5 : Moved surrogate pairing logic to text iterators #

Patch Set 6 : Add wrapped vector for efficient prepending #

Patch Set 7 : Now we don't need WTFString::prependTo() anymore #

Patch Set 8 : #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+367 lines, -130 lines) Patch
M third_party/WebKit/Source/core/editing/VisibleUnits.cpp View 1 2 3 4 5 6 7 7 chunks +22 lines, -34 lines 2 comments Download
M third_party/WebKit/Source/core/editing/iterators/CharacterIterator.h View 1 2 3 4 5 6 7 1 chunk +1 line, -2 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/CharacterIterator.cpp View 1 2 3 4 5 6 7 1 chunk +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/SearchBuffer.cpp View 1 2 3 4 5 6 7 2 chunks +5 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/SimplifiedBackwardsTextIterator.h View 1 2 3 4 5 6 7 3 chunks +4 lines, -25 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/SimplifiedBackwardsTextIterator.cpp View 1 2 3 4 5 6 7 1 chunk +35 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/SimplifiedBackwardsTextIteratorTest.cpp View 1 2 3 4 5 6 7 3 chunks +18 lines, -18 lines 0 comments Download
A third_party/WebKit/Source/core/editing/iterators/TextAccumulator.h View 1 2 3 4 5 6 7 1 chunk +76 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/editing/iterators/TextBuffer.h View 1 2 3 4 5 6 7 1 chunk +134 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIterator.h View 1 2 3 4 5 6 7 2 chunks +3 lines, -12 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp View 1 2 3 4 5 6 7 1 chunk +20 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIteratorTest.cpp View 1 2 3 4 5 6 7 2 chunks +16 lines, -16 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.h View 1 2 3 4 5 6 7 2 chunks +2 lines, -19 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.cpp View 1 2 3 4 5 6 7 1 chunk +23 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/iterators/WordAwareIterator.h View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/web/mac/WebSubstringUtil.mm View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 24 (10 generated)
Xiaocheng
4 years, 11 months ago (2016-01-19 08:53:31 UTC) #1
yosin_UTC9
https://codereview.chromium.org/1604783002/diff/40001/third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h File third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h (right): https://codereview.chromium.org/1604783002/diff/40001/third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h#newcode32 third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h:32: void accumulateTextTo(Buffer& output, bool textSecurityAware = false) Please don't ...
4 years, 11 months ago (2016-01-20 01:30:22 UTC) #4
Xiaocheng
https://codereview.chromium.org/1604783002/diff/40001/third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h File third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h (right): https://codereview.chromium.org/1604783002/diff/40001/third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h#newcode32 third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h:32: void accumulateTextTo(Buffer& output, bool textSecurityAware = false) On 2016/01/20 ...
4 years, 11 months ago (2016-01-20 01:47:46 UTC) #5
yosin_UTC9
https://codereview.chromium.org/1604783002/diff/40001/third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h File third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h (right): https://codereview.chromium.org/1604783002/diff/40001/third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h#newcode32 third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h:32: void accumulateTextTo(Buffer& output, bool textSecurityAware = false) On 2016/01/20 ...
4 years, 11 months ago (2016-01-20 02:11:16 UTC) #6
Xiaocheng
On 2016/01/20 at 02:11:16, yosin wrote: > https://codereview.chromium.org/1604783002/diff/40001/third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h > File third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h (right): > > https://codereview.chromium.org/1604783002/diff/40001/third_party/WebKit/Source/core/editing/iterators/ProgressiveTextAccumulator.h#newcode32 ...
4 years, 11 months ago (2016-01-20 04:15:17 UTC) #10
yosin_UTC9
https://codereview.chromium.org/1604783002/diff/60001/third_party/WebKit/Source/core/editing/VisibleUnits.cpp File third_party/WebKit/Source/core/editing/VisibleUnits.cpp (right): https://codereview.chromium.org/1604783002/diff/60001/third_party/WebKit/Source/core/editing/VisibleUnits.cpp#newcode762 third_party/WebKit/Source/core/editing/VisibleUnits.cpp:762: ProgressiveTextAccumulator<TextIteratorAlgorithm<Strategy>> it(searchStart, searchEnd, TextIteratorEmitsCharactersBetweenAllVisiblePositions); We should have both |accumulator| ...
4 years, 11 months ago (2016-01-20 05:21:44 UTC) #11
Xiaocheng
On 2016/01/20 at 05:21:44, yosin wrote: > https://codereview.chromium.org/1604783002/diff/60001/third_party/WebKit/Source/core/editing/VisibleUnits.cpp > File third_party/WebKit/Source/core/editing/VisibleUnits.cpp (right): > > https://codereview.chromium.org/1604783002/diff/60001/third_party/WebKit/Source/core/editing/VisibleUnits.cpp#newcode762 ...
4 years, 11 months ago (2016-01-20 08:00:08 UTC) #12
Xiaocheng
I've added the inner buffer class which automatically handles iterative buffering efficiently. It requires adding ...
4 years, 11 months ago (2016-01-20 11:27:33 UTC) #14
yosin_UTC9
On 2016/01/20 at 11:27:33, xiaochengh wrote: > I've added the inner buffer class which automatically ...
4 years, 11 months ago (2016-01-21 01:23:29 UTC) #15
Xiaocheng
On 2016/01/21 at 01:23:29, yosin wrote: > On 2016/01/20 at 11:27:33, xiaochengh wrote: > > ...
4 years, 11 months ago (2016-01-21 01:42:20 UTC) #16
Xiaocheng
On 2016/01/21 at 01:42:20, Xiaocheng wrote: > On 2016/01/21 at 01:23:29, yosin wrote: > > ...
4 years, 11 months ago (2016-01-21 07:42:46 UTC) #17
Xiaocheng
The patch (and its description) has been significantly revised. PTAL. The revised description also tells ...
4 years, 11 months ago (2016-01-22 07:19:58 UTC) #21
Xiaocheng
Ping and PTAL. The patch (and its description) has been significantly revised. The revised description ...
4 years, 11 months ago (2016-01-26 13:38:57 UTC) #23
yosin_UTC9
4 years, 10 months ago (2016-02-09 02:28:05 UTC) #24
https://codereview.chromium.org/1604783002/diff/140001/third_party/WebKit/Sou...
File third_party/WebKit/Source/core/editing/VisibleUnits.cpp (right):

https://codereview.chromium.org/1604783002/diff/140001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/editing/VisibleUnits.cpp:697: string.extract(it);
it.copyTo(string)

https://codereview.chromium.org/1604783002/diff/140001/third_party/WebKit/Sou...
third_party/WebKit/Source/core/editing/VisibleUnits.cpp:704: string.advance(it);
if (string.isSomeCondition()) {
  string.resetAccumulatedInCurrentNode(); // Not sure
  it.advance();
}

Not sure about |isSomeCondition()|, it is |m_accumulatedInCurrentNode ==
it.length())|

Powered by Google App Engine
This is Rietveld 408576698