Closed Bug 1527238 Opened 8 months ago Closed 8 months ago

Speed up server autocomplete function

Categories

(DevTools :: Console, enhancement, P1)

enhancement

Tracking

(firefox67 fixed)

RESOLVED FIXED
Firefox 67
Tracking Status
firefox67 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

Details

Attachments

(1 file)

There's a couple low hanging fruits that might give us a tiny boost:

  1. In the sort function (devtools/server/actors/webconsole.js#1241-1255), we define a regex inside the function, and we test each item, which has a cost. We can avoid using the regex since JsPropertyProvider returns a property that indicates if we are performing an element access.
  2. In JsPropertyProvider's prepareReturnedObject (devtools/shared/webconsole/js-property-provider.js#487), we spread the Set into an array and filter on it, then create a new Set again. We could iterate over the initial Set and delete item that we want to eliminate.

These are small things that will shave off a couple dozen ms (on my machine), but there worth it given the simplicity of the patch.

With those changes, DAMP return negligible perf gain (< 1%), but it does show up in profile.

Priority: -- → P1

There are 2 changes in this patch.

In js-property-provider, we iterate over a Set
and delete item we don't want into instead of
turning the Set into an array, filter on it, and
convert it back to a new Set.

In the autocomplete function, we don't use regexp
anymore in the sort callback as we already have
a way to tell if we're performing an element access.

Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a2bc2cdbcea3
Speed up webconsole server's autocomplete function; r=Honza.
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 67
You need to log in before you can comment on or make changes to this bug.