Spell checker causes laggy typing |
|||||
Issue descriptiontldr I found another gmail laggy typing bug. I think the spell checker is causing slow layout. Reproduction steps: 1. Open gmail 2. Open 4 compose windows each with lots of content (in my case a copy&paste of theverge.com). *Use Ctrl+Shit+v to copy the data, not Ctrl+v*. 3. Focus on each compose window body areas. 4. Open new compose window 5. Long press one letter key. (like s and type in ssssssss...) 6. Letters should be displayed one letter at a time. But display will lag behind. Starts with a small lag but quickly increases to few second lag. Reproduced on Linux ToT(after r397626), Mac r371207 non oilpan Didn't reproduce on Mac Firefox Here is a video of me turing spell checker on/off and trying the repro procedure. When the spell checker is off I cannot reproduce the laggy typing. https://drive.google.com/file/d/0B4aiM9jljUy8MkdJdkVzY2pXSzA/view?usp=sharing I start with spell checker on, reproduce the bug starting from step 3. Then I turn off the spell checker, and show that typing is not laggy. I repeat this one more time to make sure. This is a trace of laggy typing. https://drive.google.com/file/d/0BwRi59l_ri74aTRpRFp1NUJMV0E/view?usp=sharing This is a trace of non-laggy typing, right after gmail reload. https://drive.google.com/file/d/0BwRi59l_ri74ZmJKcTB6WkVxdms/view?usp=sharing This screenshot shows the relevant part of these traces. https://drive.google.com/file/d/0BwRi59l_ri74WXZXOUZFV3d5N3M/view?usp=sharing Usually handling a input event is fast, but when the typing is laggy layout is taking 30ms(30x usual). This is causing the main thread to be filled up with input event handling and the display falls behind. I ran a bisect on Mac but I'm not confident in the result. My bisect indicates that this bug appeared between 44.0.2394.0 (good) and 44.0.2395.0 (bad). https://chromium.googlesource.com/chromium/src/+log/44.0.2394.0..44.0.2395.0?pretty=full M44 is one year ago so it could be a recent gmail change exposed a bug in M44. But since I can't find any suspicious changes in that range, I will rerun a bisect on linux.
,
Jun 4 2016
RenderWidgetInputHandler::OnHandleInputEvent is taking ~30ms. Layout occurs twice inside the input event handler (because JS is using offsetWidth). Each FrameView::layout takes ~15ms. Inside 13ms inside layout is consumed by Document::layoutUpdated which calls DocumentMarkerController::updateRenderedRectsForMarkers. DocumentMarkerController::updateRenderedRectsForMarkers calculates the bounding box for all the Ranges generated for each marker that the spell checker generated. The # of markers is ~1500 in my case. Calculating the bounding box for a Ranges is done in Range::textRects and it looks pretty heavy (lookup layout info for all nodes in range). I'll investigate why the spell checker generates so many markers.
,
Jun 5 2016
Looks like the # of markers and the time consumed by Range::textRects is not out of the ordinary. (# of markers: 1500) * (Range::textRects: 0.01ms) = 15ms I was able to reproduce the typing lagginess in a <textarea> with many spelling errors.
,
Jun 5 2016
I created a proposed fix CL. https://codereview.chromium.org/2034363002/
,
Jun 5 2016
I was also able to make DocumentMarkerController::shiftMarkers() problematic. Repro steps: 1. Open data:text/html,<textarea rows="50" cols="200"></textarea> 2. Copy and paste the text at this url into the textarea https://gist.githubusercontent.com/keishi/d0012d6f0d547bf7c3648b20186cc2f4/raw/a7184bf9bfa1ced666095571b9e303f257759400/gistfile1.txt 3. Focus the textarea and scroll to end to run spell checker for entire text. 4. Move cursor to the beginning and long press letter key. (e.g. type something like "sssss...") 5. Typing will be laggy This is because the Document::didInsertText calls shiftMarkers() which updates the marker render rects for all markers after the insertion point. Update https://codereview.chromium.org/2034363002/ with a fix for this too.
,
Jun 10 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/2127dca0ab39f8f53dfd01329ba0d761704de821 commit 2127dca0ab39f8f53dfd01329ba0d761704de821 Author: keishi <keishi@chromium.org> Date: Fri Jun 10 13:06:45 2016 Update document marker rects lazily in frame Updating document marker rects in a layout can be slow when there are many markers. This defers the document marker update to FrameView::invalidateTreeIfNeeded. BUG= 617404 Review-Url: https://codereview.chromium.org/2034363002 Cr-Commit-Position: refs/heads/master@{#399167} [modify] https://crrev.com/2127dca0ab39f8f53dfd01329ba0d761704de821/third_party/WebKit/LayoutTests/TestExpectations [modify] https://crrev.com/2127dca0ab39f8f53dfd01329ba0d761704de821/third_party/WebKit/Source/core/dom/Document.cpp [modify] https://crrev.com/2127dca0ab39f8f53dfd01329ba0d761704de821/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp [modify] https://crrev.com/2127dca0ab39f8f53dfd01329ba0d761704de821/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h [modify] https://crrev.com/2127dca0ab39f8f53dfd01329ba0d761704de821/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp [modify] https://crrev.com/2127dca0ab39f8f53dfd01329ba0d761704de821/third_party/WebKit/Source/core/editing/markers/RenderedDocumentMarker.h
,
Jun 10 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/df7a22653249c55461ed8fc1f13026cb729995c0 commit df7a22653249c55461ed8fc1f13026cb729995c0 Author: Rebaseline Bot <blink-rebaseline-bot@chromium.org> Date: Fri Jun 10 14:57:30 2016 Auto-rebaseline for r399167 https://chromium.googlesource.com/chromium/src/+/2127dca0a BUG= 617404 TBR=keishi@chromium.org Review URL: https://codereview.chromium.org/2057063003 . Cr-Commit-Position: refs/heads/master@{#399183} [modify] https://crrev.com/df7a22653249c55461ed8fc1f13026cb729995c0/third_party/WebKit/LayoutTests/TestExpectations [modify] https://crrev.com/df7a22653249c55461ed8fc1f13026cb729995c0/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/repaint/text-match-document-change-expected.png [modify] https://crrev.com/df7a22653249c55461ed8fc1f13026cb729995c0/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/text-match-document-change-expected.png
,
Jun 15 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/2127dca0ab39f8f53dfd01329ba0d761704de821 commit 2127dca0ab39f8f53dfd01329ba0d761704de821 Author: keishi <keishi@chromium.org> Date: Fri Jun 10 13:06:45 2016 Update document marker rects lazily in frame Updating document marker rects in a layout can be slow when there are many markers. This defers the document marker update to FrameView::invalidateTreeIfNeeded. BUG= 617404 Review-Url: https://codereview.chromium.org/2034363002 Cr-Commit-Position: refs/heads/master@{#399167} [modify] https://crrev.com/2127dca0ab39f8f53dfd01329ba0d761704de821/third_party/WebKit/LayoutTests/TestExpectations [modify] https://crrev.com/2127dca0ab39f8f53dfd01329ba0d761704de821/third_party/WebKit/Source/core/dom/Document.cpp [modify] https://crrev.com/2127dca0ab39f8f53dfd01329ba0d761704de821/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp [modify] https://crrev.com/2127dca0ab39f8f53dfd01329ba0d761704de821/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h [modify] https://crrev.com/2127dca0ab39f8f53dfd01329ba0d761704de821/third_party/WebKit/Source/core/editing/markers/DocumentMarkerControllerTest.cpp [modify] https://crrev.com/2127dca0ab39f8f53dfd01329ba0d761704de821/third_party/WebKit/Source/core/editing/markers/RenderedDocumentMarker.h
,
Jun 15 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/df7a22653249c55461ed8fc1f13026cb729995c0 commit df7a22653249c55461ed8fc1f13026cb729995c0 Author: Rebaseline Bot <blink-rebaseline-bot@chromium.org> Date: Fri Jun 10 14:57:30 2016 Auto-rebaseline for r399167 https://chromium.googlesource.com/chromium/src/+/2127dca0a BUG= 617404 TBR=keishi@chromium.org Review URL: https://codereview.chromium.org/2057063003 . Cr-Commit-Position: refs/heads/master@{#399183} [modify] https://crrev.com/df7a22653249c55461ed8fc1f13026cb729995c0/third_party/WebKit/LayoutTests/TestExpectations [modify] https://crrev.com/df7a22653249c55461ed8fc1f13026cb729995c0/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/repaint/text-match-document-change-expected.png [modify] https://crrev.com/df7a22653249c55461ed8fc1f13026cb729995c0/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/text-match-document-change-expected.png
,
Jun 24 2016
,
Jul 22 2016
This is also true for textareas on wikis please fix this im using a dev build chromium and i need to disable the spellchecker in order to be able to work on larger articles within wikipedia. Chromium 54.0.2798.0 (Entwickler-Build) (64-Bit) Überarbeitung c62f109fe5d7681051f4b8144a16ffc86b692bdc-refs/heads/master@{#405858}
,
Jul 23 2016
Issue 237433 - related?
,
Jul 25 2016
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by keishi@chromium.org
, Jun 4 2016