Skip to content

Big perf difference between running Dart app via pub global activate, or pub run #1349

Closed
@sethladd

Description

@sethladd

Hi! We'd like to start using pub run to launch our scripts from within our app, but it seems much slower than scripts launched after pub global activate. The startup perf is enough for us to wonder if we're doing something wrong, or if there's a bug.

tldr: app runs in 1 sec via pub run, and 0.3 seconds after pub global activate.

Here are the scenarios:

A) add flutter: any to an empty pubspec, run pub get, then run pub run flutter list --help
B) pub global activate flutter, then run flutter list --help

Results from scenario A:

~/tmp/flutterpkg$ time pub run flutter list --help
List all connected devices.

Usage: flutter list [arguments]
-h, --help       Print this usage information.
-d, --details    Log additional details about attached devices.

Run "flutter help" to see global options.

real    0m1.062s
user    0m0.921s
sys 0m0.182s

Results from scenario B:

~/tmp/flutterpkg$ time flutter list --help
List all connected devices.

Usage: flutter list [arguments]
-h, --help       Print this usage information.
-d, --details    Log additional details about attached devices.

Run "flutter help" to see global options.

real    0m0.291s
user    0m0.263s
sys 0m0.049s

Perf is definitely a feature for us. Any advice on how to get the pub run case to be as fast as the pub global activate case, that would be a big help. We'd really like to get to a single package that contains our libraries and tools, but the startup time of pub run flutter --list is prohibitive.

~/tmp/flutterpkg$ pub --version
Pub 1.13.0-dev.7.1

Thanks for any advice!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions