dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.12k stars 1.57k forks source link

Dart platform size #39439

Closed ghost closed 9 months ago

ghost commented 4 years ago

I went to this page:

https://dart.dev/tools/sdk/archive

and I discovered that the download is 202 MB. This was surprising to me, so I looked at other languages:

So Dart is 23% larger than Rust. Or to put another way, Dart is larger than C#, Python and PHP combined. Can anything be done about this or is the large size unavoidable?

xvrh commented 4 years ago

Here is the evolution of the size of the SDK in the last versions:

v2.6.1: 220.33 MB
v2.5.0: 274.85 MB
v2.4.0: 127.93 MB
v2.3.0: 152.08 MB
v2.2.0: 100.65 MB
v2.1.0: 107.77 MB
v2.0.0: 131.27 MB
v1.24.0: 60.78 MB
v1.23.0: 50.88 MB
v1.22.0: 41.54 MB
v1.21.0: 24.84 MB
v1.20.1: 21.86 MB
v1.19.0: 21.73 MB
v1.18.0: 22.31 MB
v1.17.0: 22.07 MB
v1.16.0: 21.55 MB
v1.15.0: 19.28 MB
v1.14.0: 12.45 MB
v1.13.0: 12.99 MB
v1.12.0: 14.29 MB
v1.11.0: 11.51 MB

It seems it tooks 140MB more between 2.4 and 2.5. It's probably due to the file bin/model/lexeme/model.tflite added for this feature: https://medium.com/dartlang/announcing-dart-2-5-super-charged-development-328822024970

mit-mit commented 4 years ago

We're aware of the issue, and are discussing potential options for resolving it.

ghost commented 4 years ago

I just noticed that the 32-bit version on the same page (ia32) is only 75 MB. I would expect them to be similar size

$ git diff --stat dartsdk-windows-ia32-release dartsdk-windows-x64-release |
grep 'Bin 0' | numfmt --field 6 --group
 .../dart-sdk/bin/dartaotruntime.exe                | Bin 0 -> 3,576,832 bytes
 .../dart-sdk/bin/model/lexeme/model.tflite         | Bin 0 -> 108,201,048 bytes
 .../bin/snapshots/kernel-service.dart.snapshot     | Bin 0 -> 26,886,688 bytes
 .../bin/snapshots/libtensorflowlite_c-linux64.so   | Bin 0 -> 2,185,208 bytes
 .../bin/snapshots/libtensorflowlite_c-mac64.so     | Bin 0 -> 1,822,548 bytes
 .../bin/snapshots/libtensorflowlite_c-win64.dll    | Bin 0 -> 6,202,238 bytes
mit-mit commented 1 year ago

There are broadly a few overall reasons for the current large size:

1) Dart supports a very wide range of platforms, so we have a very large selection of compilers, which increases size 2) Dart has a very complete set of included tools for writing, debugging, and inspecting Dart code.

I doubt we can make a significant dent in the size unless we change some assumptions of what is in the SDK. One option would be to make the SDK more minimal, and focused on the ability to just run and compile Dart. The additional components needed for things like analysis (e.g. dart analyze), documentationdart doc, and tools (e.g. the [DevTools]() inspection tool served bydart run --observe) would not be included, but if needed would have to get downloaded by a command (saydart setup devtools`). If we did this, we could significantly reduce the size (say, by about half).

I'm curious to hear input on how folks are using the Dart SDK, and in which cases size is important and what features would need to be supported there?