Closed Bug 1488336 Opened 6 years ago Closed 6 years ago

sourceeditor setAutocompletionText could be faster

Categories

(DevTools :: Shared Components, enhancement, P1)

enhancement

Tracking

(firefox64 fixed)

RESOLVED FIXED
Firefox 64
Tracking Status
firefox64 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

Details

Attachments

(1 file)

In setAutocompletionText [1] , we do 2 things: - clear any previous autocompletion mark that might exist - then, if the text provided isn't falsy, add a new autocompletion mark Each operation seems to trigger 2 reflows (so 4 reflows for setting the text), which can be quite an issue if the reflows are slow (e.g. the console panel lately). We can probably make this better by grouping clearing marks and adding the new one in a codemirror operation [2]. [1] https://searchfox.org/mozilla-central/rev/c3fef66a5b211ea8038c1c132706d02db408093a/devtools/client/sourceeditor/editor.js#1296-1310 [2] https://codemirror.net/doc/manual.html#operation
This way, codeMirror does not trigger so many reflows and makes setAutocompletionText faster. An unwanted side-effect was that it made closing the console a lot slower. Looking at the closing code of the JsTerm, we do call setAutocompletionText("") in the end, which we don't really need since we destroy the editor shortly after. Removing this call keeps closing time the same as before.
Comment on attachment 9006157 [details] Bug 1488336 - Group clear mark and markText for completion text; r=bgrins. Brian Grinstead [:bgrins] has approved the revision.
Attachment #9006157 - Flags: review+
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3edd9e52dbfe Group clear mark and markText for completion text; r=bgrins.
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 64
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: