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

Issue 330383004: Oilpan: Introduce TempRangeScope to avoid needless Range attaches on Document. (Closed)

Created:
6 years, 6 months ago by Mads Ager (chromium)
Modified:
3 years, 10 months ago
CC:
blink-reviews, blink-reviews-html_chromium.org, sof, eae+blinkwatch, blink-reviews-dom_chromium.org, dglazkov+blink, groby+blinkspell_chromium.org, rwlbuis
Project:
blink
Visibility:
Public.

Description

Oilpan: Introduce TempRangeScope to avoid needless Range attaches on Document. In multiple places Ranges are used as short-lived subcomputation results. These short-lived result objects are registered with the Document even though they will be unreachable without any changes to the document. With Oilpan this becomes a performance issue because we require a GC for the Range objects to die and be removed from the set of ranges on the Document and we end up spending quite a bit of time running though ranges that need no updating. With the TempRangeScope we avoid registering the temporary ranges with the document. R=haraken@chromium.org, oilpan-reviews@chromium.org

Patch Set 1 #

Total comments: 2

Patch Set 2 : Address review comments. #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+53 lines, -4 lines) Patch
M Source/core/dom/Document.cpp View 1 8 chunks +8 lines, -0 lines 0 comments Download
M Source/core/dom/Range.h View 1 1 chunk +26 lines, -0 lines 1 comment Download
M Source/core/dom/Range.cpp View 1 3 chunks +8 lines, -4 lines 2 comments Download
M Source/core/editing/FrameSelection.cpp View 1 1 chunk +1 line, -0 lines 2 comments Download
M Source/core/editing/SpellChecker.cpp View 1 2 chunks +4 lines, -0 lines 3 comments Download
M Source/core/editing/VisibleUnits.cpp View 1 2 chunks +4 lines, -0 lines 0 comments Download
M Source/core/html/HTMLTextFormControlElement.cpp View 1 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
Mads Ager (chromium)
6 years, 6 months ago (2014-06-24 11:46:29 UTC) #1
Mads Ager (chromium)
This improves performance on DOM/textarea-edit.html from 1.3 runs/s to 1.7 runs/s on my machine.
6 years, 6 months ago (2014-06-24 11:47:20 UTC) #2
haraken
+yosin, +yutak Mads: - Does the performance regression come from the overhead of weak processing ...
6 years, 6 months ago (2014-06-24 11:57:16 UTC) #3
Mads Ager (chromium)
On 2014/06/24 11:57:16, haraken wrote: > +yosin, +yutak > > Mads: > > - Does ...
6 years, 6 months ago (2014-06-24 12:02:33 UTC) #4
Mads Ager (chromium)
Added asserts to all methods that iterate the AttachedRangeSet to make sure that we are ...
6 years, 6 months ago (2014-06-24 12:16:51 UTC) #5
haraken
LGTM. Let's wait for an approval of yosin@ or yutak@. https://codereview.chromium.org/330383004/diff/20001/Source/core/dom/Range.cpp File Source/core/dom/Range.cpp (right): https://codereview.chromium.org/330383004/diff/20001/Source/core/dom/Range.cpp#newcode73 ...
6 years, 6 months ago (2014-06-24 12:24:23 UTC) #6
wibling-chromium
lgtm An alternative approach would be to have a subclass, e.g. AttachedRange, which attached itself ...
6 years, 6 months ago (2014-06-24 13:19:22 UTC) #7
wibling-chromium
On 2014/06/24 13:19:22, wibling-chromium wrote: > lgtm > > An alternative approach would be to ...
6 years, 6 months ago (2014-06-24 13:23:16 UTC) #8
yosin_UTC9
I prefer to rewrite functions using *ephemeral* Range objects to use two Position objects rather ...
6 years, 6 months ago (2014-06-25 01:22:20 UTC) #9
yosin_UTC9
Note: yoichio@ is working to remove VisiblePosition from HTMLTextFormControl. So, temporary Range object won't be ...
6 years, 6 months ago (2014-06-25 01:57:12 UTC) #10
yoichio
On 2014/06/25 01:57:12, yosi wrote: > Note: yoichio@ is working to remove VisiblePosition from HTMLTextFormControl. ...
6 years, 6 months ago (2014-06-25 02:09:24 UTC) #11
Mads Ager (chromium)
On 2014/06/25 01:22:20, yosi wrote: > I prefer to rewrite functions using *ephemeral* Range objects ...
6 years, 6 months ago (2014-06-25 05:31:03 UTC) #12
Mads Ager (chromium)
6 years, 6 months ago (2014-06-25 11:41:42 UTC) #13
I don't think I have enough knowledge about this code to figure out how to
easily avoid these temporary Range objects. Thanks for volunteering to help
figure this out yosin@, I'll file bug reports for it and we can discuss further
there.

https://codereview.chromium.org/330383004/diff/20001/Source/core/editing/Fram...
File Source/core/editing/FrameSelection.cpp (right):

https://codereview.chromium.org/330383004/diff/20001/Source/core/editing/Fram...
Source/core/editing/FrameSelection.cpp:332: TemporaryRangeScope scope;
On 2014/06/25 01:22:20, yosi wrote:
> It seems tempoary new Range object is created by
|FrameSelection::firstRange()|
> when |m_logicalRange| isn't null. But, cloned range is used for comparision.
So,
> we don't need to actually create new Range object.
> 
> We should change this logic to avoid creating Range object rather than using
> |TemporaryRangeScope|.

It seems that all the comparison logic is all hidden inside the Range object
abstraction at this point. It is not clear to me if there are other comparison
methods that give me what I need here or how to split out the comparison logic
from the Ranges.

https://codereview.chromium.org/330383004/diff/20001/Source/core/editing/Spel...
File Source/core/editing/SpellChecker.cpp (right):

https://codereview.chromium.org/330383004/diff/20001/Source/core/editing/Spel...
Source/core/editing/SpellChecker.cpp:749:
m_frame.document()->markers().removeMarkers(wordRange.get(),
DocumentMarker::Spelling);
On 2014/06/25 01:22:20, yosi wrote:
> It seems if we hare removeMakrers() which takes two Position objects, we don't
> need to pass Range.

It would seem so. However, removeMarkers uses a TextIterator which uses more
temporary range objects to do its job. It is not clear to me what is reasonable
to expose from the TextIterator.

I'll take your offer of helping out with this. I'll file bug reports for this
and we can discuss further there. Thanks.

Powered by Google App Engine
This is Rietveld 408576698