Open matofesi opened 6 years ago
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:
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?
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.
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).
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.
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()
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:
While the same exact script run with 2.0.0 shows this:
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:
vs this:
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?