Skip to content

optimize _updateLocalClasses in Inspector Service #4393

Closed as not planned
Closed as not planned

Description

@CoderDake

_updateLocalClasses fetches each of the objects individually. This causes a performance bottleneck on pub root directory change.
If this class ends up being needed, the we will need to find a call that batches the request, to avoid overloading the vm with rpc calls.

NOTE: isLocalClass may not be hooked up to the fronted properly yet. So doing this optimization may not be needed until that is accomplished

Activity

  1. changed the title [-]optimize isLocalClass in Inspector Service[/-] [+]optimize `_updateLocalClasses` in Inspector Service[/+] on Aug 19, 2022
  2. CoderDake commented on Aug 19, 2022

    @CoderDake
    ContributorAuthor

    Ben recommends

    final isolate = inspectorLibrary.isolate!;
    final futures = <Future>[];
    for (final libraryRef in isolate.libraries!) {
      if (isLocalUri(libraryRef.uri!)) {
        final future = inspectorLibrary.service.getObject(
            isolate.id!, libraryRef.id!
          ).then((result) {
            final library = result as Library;
            for (final classRef in library.classes!) {
              localClasses[classRef.name!] = classRef;
            }
          });
        futures.add(future);
      }
    }
    await Future.wait(futures);
    

    as a temporary measure, although we may still need to find a batch approach long term
    https://github.com/flutter/devtools/pull/4394/files#r950499503

  3. added
    P3issues we think are valid but not important
    and removed on Jul 5, 2023
  4. johnpryan commented on Oct 22, 2026

    @johnpryan
    Contributor

    It looks like _updateLocalClasses and the associated rootPackages logic in InspectorService were removed in #7175, so this optimization is no longer applicable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3issues we think are valid but not important

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions