Skip to content

Avoid invoking pub for simple instances of "pub run" #24736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks
nex3 opened this issue Oct 26, 2015 · 1 comment
Closed
2 tasks

Avoid invoking pub for simple instances of "pub run" #24736

nex3 opened this issue Oct 26, 2015 · 1 comment
Labels
area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). closed-obsolete Closed as the reported issue is no longer relevant customer-flutter P2 A bug or feature request we're likely to work on status-blocked Blocked from making progress by another (referenced) issue type-enhancement A request for a change that isn't a bug

Comments

@nex3
Copy link
Member

nex3 commented Oct 26, 2015

Currently, pub run invocations always invoke the pub executable. The executable is necessary to fully handle all the potential complexities of locating, configuring, and potentially re-snapshotting the executable, but it also involves a substantial performance hit, some of which comes unavoidably just from loading pub's code.

The best way to address this is to avoid invoking pub at all. It should be possible for the script that invokes pub to cheaply detect a pub run invocation that doesn't need special configuration, and to directly invoke the Dart executable. In particular, it should check:

  • That the run command is being invoked without any global arguments.
  • That the only arguments to run are the executable name and, optionally, --checked.
  • That the executable name is a single Dart identifier or two Dart identifiers separated by a colon.
  • That the corresponding executable snapshot exists in .pub (for example, for pub run foo:bar, the snapshot will be in .pub/bin/foo/bar.dart.snapshot).
  • That pubspec.yaml, pubspec.lock, and .packages files all exist.
  • That the snapshot has a more recent modification time than pubspec.yaml.
  • That the snapshot is compatible with the current dart executable (blocked on Add a facility to test whether a snapshot is up-to-date without running it #20802).

If all of these are true, the script should exec the snapshot (or whatever the equivalent of exec is on Windows).

This is blocked on:


I'm filing this in the SDK repo because it involves changing the POSIX and Windows pub wrapper scripts, which live here. Also, unfortunately, I don't have the shell expertise (especially with the Windows shell) to implement this myself. That said, I'm happy to work with someone who does have that expertise to get this implemented.

@nex3 nex3 added Type-Enhancement area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). labels Oct 26, 2015
@nex3 nex3 added the status-blocked Blocked from making progress by another (referenced) issue label Oct 26, 2015
@sethladd
Copy link
Contributor

Thanks for the thorough analysis.

@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed Priority-Medium labels Mar 1, 2016
@lrhn lrhn added the closed-obsolete Closed as the reported issue is no longer relevant label Mar 27, 2022
@lrhn lrhn closed this as completed Mar 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). closed-obsolete Closed as the reported issue is no longer relevant customer-flutter P2 A bug or feature request we're likely to work on status-blocked Blocked from making progress by another (referenced) issue type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants