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

Dart lang run very slow #35619

Closed
netroby opened this Issue Jan 10, 2019 · 6 comments

Comments

Projects
None yet
2 participants
@netroby
Copy link

netroby commented Jan 10, 2019

I am running dart lang to print simple hello world, as compare to python

fs hello # cat main.dart 
#!/usr/bin/env dart
void main() {
    print("hello world");
}
fs hello # cat main.py
#!/usr/bin/env python
print("hello world");
fs hello # time dart main.dart 
hello world
dart main.dart  5.13s user 0.34s system 143% cpu 3.799 total
fs hello # time python main.py 
hello world
python main.py  0.03s user 0.02s system 96% cpu 0.045 total

looks dart lang very slow, is it normal ?

@mraleph

This comment has been minimized.

Copy link
Contributor

mraleph commented Jan 10, 2019

Can you give some information about your system (e.g. OS and hardware)?

Also is your dart by any chance a symbolic link? (could you post output of ls -al $(which dart)).

In any case you can take a snapshot if you need to run some program repetitively:

$ dart --snapshot=main.snapshot main.dart
$ time dart main.snapshot
@netroby

This comment has been minimized.

Copy link

netroby commented Jan 17, 2019

fs hello # dart --snapshot=main.snapshot main.dart
fs hello # time dart main.snapshot
hello world
dart main.snapshot  0.81s user 0.08s system 162% cpu 0.551 total
fs hello # time python main.py 
hello world
python main.py  0.04s user 0.00s system 97% cpu 0.045 total
fs hello # time dart main.dart 
hello world
dart main.dart  5.12s user 0.37s system 144% cpu 3.794 total

@netroby

This comment has been minimized.

Copy link

netroby commented Jan 17, 2019

my pc cpu

AMD E-350 Processor
8GB memory

@mraleph

This comment has been minimized.

Copy link
Contributor

mraleph commented Jan 17, 2019

Time running from snapshot seems reasonable.

If you have some concrete performance requirement that you would like to meet let us know.

I am closing the issue for now.

@mraleph mraleph closed this Jan 17, 2019

@netroby

This comment has been minimized.

Copy link

netroby commented Jan 18, 2019

Dart lang slow than python? the performance looks not good.

@mraleph

This comment has been minimized.

Copy link
Contributor

mraleph commented Jan 18, 2019

What you are measuring is startup latency for a very small program. Dart does more things on startup - so startup latency is somewhat higher. However it only matters if you are running something that does no actual work and you would like to really quickly start the app which does nothing.

To illustrate the point about "doing more work": when you run VM it starts a couple of helper isolates, which is not something that you really benefit from usually. I made a dirty patch where I suppress start up of those isolates:

╭─ ~
╰─$ time dart hello.snap
Hello, World!
dart hello.snap  0.20s user 0.05s system 195% cpu 0.127 total
╭─ ~
╰─$ time dart --donot-start-helper-isolates hello.snap
Hello, World!
dart --donot-start-helper-isolates hello.snap  0.05s user 0.02s system 103% cpu 0.066 total

Yes, this improves startup time (and memory usage probably) - but it is unclear if this is something that is important or not because it is only going to be visible on very small programs.

I did however file a bug to clean this up #35700

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