mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:09:49 +00:00
6e2536f585
Previously doubles was saved as strings in the string table, with a DoubleLiteral holding a StringReference. This can cause overhead in both computation time (converting the double to and from string) as well as size (e.g. a single usage of the previously unused double 1000000.42 would use (at least) * 10 bytes for the characters * 1 byte for the size * 1 byte for the reference to the string whereas saving it as a double would simply save the 8 bytes. On the other hand the string table doesn't contain duplicates so many usages of the same double will use more space. The SDK dill file size decreases slightly (< 1 KB). On a Dart file with 1M different doubles (0.42, 1.42, ..., 999999.42) added to a list: Before: compile and write via fasta (non-strong-mode): 0:12.18 Reading (via dart, eager): 2500-2600 ms Writing (to null sink) (after reading): 1600-1800 ms Output dill file (via fasta compile): ~62 MB After: compile and write via fasta (non-strong-mode): 0:11.76 Reading (via dart, eager): 2050-2350 ms Writing (to null sink) (after reading): 400-550 ms Output dill file (via fasta compile): ~54 MB Running the dill file is ~the same time, but "Maximum resident set size (kbytes)" (from /usr/bin/time -v) decreases with ~4%. On the other side, if it's 1M of the same doubles (0.42), while compiling is ~the same speed, the output dill goes from 43MB to 50MB. Surprisingly the "Maximum resident set size (kbytes)" still decreases though (~3%). Running flutter test in flutter/packages/flutter: Before: ``` 02:33 +2425 ~18: All tests passed! 02:28 +2425 ~18: All tests passed! 02:28 +2425 ~18: All tests passed! ``` After: ``` 02:12 +2425 ~18: All tests passed! 02:11 +2425 ~18: All tests passed! 02:12 +2425 ~18: All tests passed! ``` So that's -12.0267% +/- 3.15253% File size of a dill file of an arbitrary test using flutter is reduced by ~44 KB (~0.3%). Change-Id: I64151376cde1dae6f0d02b3d96991bc432a994ae Reviewed-on: https://dart-review.googlesource.com/41660 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Kevin Millikin <kmillikin@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com> |
||
---|---|---|
.github | ||
build | ||
client | ||
docs | ||
pkg | ||
runtime | ||
samples | ||
samples-dev | ||
sdk | ||
tests | ||
third_party | ||
tools | ||
utils | ||
.clang-format | ||
.gitattributes | ||
.gitignore | ||
.gn | ||
.mailmap | ||
.packages | ||
AUTHORS | ||
BUILD.gn | ||
CHANGELOG.md | ||
codereview.settings | ||
dartdoc_options.yaml | ||
DEPS | ||
LICENSE | ||
PATENTS | ||
PRESUBMIT.py | ||
README.dart-sdk | ||
README.md | ||
WATCHLISTS |
Dart
Dart is an open-source, scalable programming language, with robust libraries and runtimes, for building web, server, and mobile apps.
Using Dart
Visit the dartlang.org to learn more about the language, tools, getting started, and more.
Browse pub.dartlang.org for more packages and libraries contributed by the community and the Dart team.
Building Dart
If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.
There are more documents on our wiki.
Contributing to Dart
The easiest way to contribute to Dart is to file issues.
You can also contribute patches, as described in Contributing.