-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
pub run "hello world" takes 2.5 seconds #20212
Comments
This comment was originally written by @sethladd I guess this is because there's transformers infrastructure that needs to get booted up? Note there are no transformers configured, here's the pubspec.yaml: name: stagehand Not sure why, but it appears to be spawning up ~/WebstormProjects/stagehand$ pub run -v stagehand |
This comment was originally written by @sethladd FWIW it seems to be a little quicker via pub global: ~/WebstormProjects/stagehand[master]$ time pub global run stagehand real 0m2.064s Not sure why. Here's the log: ~/WebstormProjects/stagehand[master]$ pub global run -v stagehand |
Removed Priority-Unassigned label. |
The vast majority of this time is being spent working around issue #16368. I don't think it's worth worrying about how to speed this up until that's fixed. Added NotPlanned label. |
Curious, why does Spawning "git --version" |
If it's run within a git project, pub uses "git ls-files" to determine which files are part of the project. |
This comment was originally written by @sethladd AFAIU I see that my local |
Eventually it will work with path and git dependencies as well. We could add some code to avoid even trying git for hosted packages, but until we have evidence that git is actually causing performance problems I don't think it's worthwhile;. |
To repro: Go to http://pub.dartlang.org/packages/simple_http_server and follow the instructions for install and use. :) |
Turns out there are more things to it, than issue #16368. Suggested CLs so far: https://codereview.chromium.org/429173002/ While these fixes alone will not bring it down to a acceptable level, this is a good start. I'll continue to investigate, as these improvements will help other pub commands and packages as well. |
Thanks for hacking on this, Anders! |
Committed one of the previous CLs so far. Created a few other CLs for this: https://codereview.chromium.org/439223002/ |
Thanks! What's a good exit criteria for this issue, so we know when to close? 500ms for a "hello world" ? Can we do better? |
On my tests, the VM takes >100ms just to load and compile pub before it even hits main(). I would love to get that number down, but that's obviously out of our control. It also takes something (very roughly!) around 50ms to spawn the second process. But, beyond those hits, we should be able to make a lot of progress. I'll be OK if we can get a hello world that doesn't use any transformers down to 200ms. That will require a lot of work, though. We have ideas in mind on what do to here, but haven't set aside time for them this quarter. I won't be delighted unless we can get it down to <100ms. cc @iposva-google. |
|
This comment was originally written by @sethladd What's reasonable by 1.6, do we reckon? |
Process. We're considering using an isolate but that affects the behavior in some user visible ways. (For example, Platform.script would now return pub's script instead of their own.)
The user's application. The basic idea is that the user does "pub run foo". Pub starts up, runs all of the appropriate transformers and then runs bin/foo.dart (using an HTTP URL that points back to pub's own server) so that the process can load transformed Dart code. The spawned process is for that application. |
1.6 is very soon, isn't it? I don't think we'll have any significant optimization in by then. I did do a little profiling today and I think if my idea for routing around barback for packages that don't use transformers works, it should shave off a chunk of the time. On my hacked up test case, it went from ~1.5s to ~1.15s. |
This issue has been moved to dart-lang/pub#1063. |
This issue was originally filed by @sethladd
Hi,
Just testing out pub run. On my macbook air, running Dart 1.6, and running a "hello world" script, it's taking 2.5 seconds. That seems long for a simple script.
~/WebstormProjects/stagehand$ dart --version
Dart VM version: 1.6.0-dev.4.0 (Fri Jul 18 06:17:25 2014) on "macos_x64"
~/WebstormProjects/stagehand$ time pub run stagehand
I'll turn it up to 11.
real 0m2.542s
user 0m2.000s
sys 0m0.368s
~/WebstormProjects/stagehand$ cat bin/stagehand.dart
main() {
print("I'll turn it up to 11.");
}
For reference, here's a raw run:
~/WebstormProjects/stagehand$ time dart bin/stagehand.dart
I'll turn it up to 11.
real 0m0.091s
user 0m0.073s
sys 0m0.016s
The text was updated successfully, but these errors were encountered: