devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Reduce number of requests when inspecting widget

Open CoderDake opened this issue 3 years ago • 2 comments

When fighting on a widget or clicking to inspect a widget. A lot of requests are sent to the service in order to populate the card. This causes a lot of delay in our processes that display that information.

We should find a way to deduce the another of requests that it depends on our dogs a way to combine the requests into one in order to avoid latency pile ups

CoderDake avatar Sep 08 '22 20:09 CoderDake

Heads up:

  • I am working on a change in SDK (ddc) to cache the expression compiler state. This will make subsequent requests much faster then the first (which actually happens before the inspector is ready). In my experiment the compilation time per expression is 5-10x faster then before.

  • I am working on a change in dwds that batches the requests that arrive close together for faster evaluation. PR: https://github.com/dart-lang/webdev/issues/1747

    After the change is done, if you can fire a number of evals in parallel (ie not awaiting for one before firing the next request), they should be processed as one by dwds to reduce time of compilation and evaluation. The requests are batches as long as they come for the same library and the same scope (AFAIK all inspector requests are for the widget_inspector library and empty scope).

    The behavior of VmService.evaluate() API would be the same as before on your end - one request will get one response, the batching is handled on the dwds side.

annagrin avatar Sep 09 '22 19:09 annagrin

It looks like that buildVariablesTree call which spawns all of the requests to eval, is in need of some refactoring. I was able to find a way to lazy load variables such that way fewer requests needed to be sent at a time, but it was prohibitively difficult to find a away to have the TreeView reflect that and load properly.

I'm going to bump this ticket down my list a little bit and come back to it with fresh eyes in a little while

CoderDake avatar Sep 23 '22 20:09 CoderDake