Skip to content

Dart 2.0.0 on Raspberry Pi - performance drop #34172

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

Open
matofesi opened this issue Aug 17, 2018 · 6 comments
Open

Dart 2.0.0 on Raspberry Pi - performance drop #34172

matofesi opened this issue Aug 17, 2018 · 6 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@matofesi
Copy link

matofesi commented Aug 17, 2018

I've just updated dart-sdk on my Raspberry Pi box from 1.24.3 to 2.0.0 (using official armv7 .zip download).
I've updated my scripts for API changes etc. and now as it seems to work I've been observing a huge drop in performance between previous and current version.

I've chosen a script that is mostly computation without much of I/O etc. and the difference is terrible...

Run with dart 1.24.3 it shows this:

$ time /opt/dart-sdk-1/bin/dart scripts/gen_board.dart 6 >/dev/null
real    0m0.934s
user    0m1.065s
sys     0m0.080s

While the same exact script run with 2.0.0 shows this:

$ time /opt/dart-sdk-2/bin/dart scripts/gen_board.dart 6 >/dev/null
real    0m8.440s
user    0m10.690s
sys     0m0.606s

With dart 2 script executes over 10 times longer. Other scripts with I/O etc. also work much slower and even simple "Hello world" shows this:

$ time /opt/dart-sdk-1/bin/dart test.dart 
Hello world!
real    0m0.833s
user    0m0.929s
sys     0m0.111s

vs this:

$ time /opt/dart-sdk-2/bin/dart test.dart 
Hello world!
real    0m7.192s
user    0m9.563s
sys     0m0.441s

I'm not sure if maybe I'm doing something wrong (I've been using dart on this box for well over a year and it always worked fine and gave no problems with updates etc.) or maybe there is something wrong with official armv7 downloads?

Is there any reason the dart executable is over 3 times bigger in size?

-rwxr-x--- 1 root root 7919880 Dec 18  2017 /opt/dart-sdk-1/bin/dart
-rwxr-xr-x 1 root root 24608092 Aug  6 11:34 /opt/dart-sdk-2/bin/dart
@mraleph mraleph added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Aug 17, 2018
@mraleph
Copy link
Member

mraleph commented Aug 17, 2018

Try this:

$ /opt/dart-sdk-2/bin/dart --snapshot=scripts/gen_board.dart.snapshot scripts/gen_board.dart
$ time /opt/dart-sdk-2/bin/dart scripts/gen_board.dart.snapshot 6

Does this improve the time?

Is there any reason the dart executable is over 3 times bigger in size?

It now contains:

  • a Dart 2 parser written in Dart (also known as common front-end) in the form of app-jit snapshot.
  • a Dart core libraries both as a Kernel AST and their source in strong mode
  • a Dart core libraries both as a Kernel AST and their source in Dart 1 mode (this is temporary).

@matofesi
Copy link
Author

Yes. It helps - running from snapshot makes it only ~1.5 - 2 times slower than 1.24

$ time /opt/dart-sdk-2/bin/dart scripts/gen_board.dart.snapshot 6 >/dev/null
real 0m1.528s
user 0m2.430s
sys 0m0.142s

It's better, but still nowhere near perfect. Does this mean I should create snapshots for all my scripts and run them that way?

@mraleph
Copy link
Member

mraleph commented Aug 17, 2018

Does this mean I should create snapshots for all my scripts and run them that way?

for now yes - we will be working on making CFE faster - but it will take time.

Yes. It helps - running from snapshot makes it only ~1.5 - 2 times slower than 1.24

If your code is open source we can look at what is causing the performance drop and if the ongoing effort will fix it for you in Dart 2.1 release.

@matofesi
Copy link
Author

Ok. So I'll just do that (or stay with 1.24 for now) and check future versions for any changes.

The code itself is just one of the scripts I did to see if I can create some simple algorithm. It's nothing special and I use it as a test because it's mostly some simple computations without penalty of I/O. I could upload it somewhere, but I don't think it's really necessary as every other script I run on the same box seems to have the same drop in 2.0.0 and the same raise when running from snapshot (even "Hello World" shows the same results ~10 times slower when run directly and ~2 times slower when run from snapshot).

@mraleph
Copy link
Member

mraleph commented Aug 17, 2018

If you can share your script please do share it - we are always looking to expand our benchmark suite to make sure we are covering all bases. Even though all your scripts degraded in performance that does not mean that they degraded for the same reason or that the fixes we are doing will fix all of them.

@matofesi
Copy link
Author

Ok.
The script is here: https://www.esi.com.pl/files/gen_board.dart

It's a simple permutations generator to fill the square board of given size in given steps making sure that after each step is completed the same number of fields in every row/column is filled. Algorithm probably have its name, but I did it slightly out of boredom and to see if I can do it with Dart ;)

Oh... And the only function from dart:io it uses is exit()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

2 participants