|
|
|
|
|
by munificent
5093 days ago
|
|
The JS output that gets generated from a Dart program isn't just "dart_size * multiplier", it's "dart_size * multiplier + constant". So, when you see a tiny Dart program being compiled to a large amount of JS, that doesn't mean a large Dart program will compile to a huge amount of JS, it just means that the constant is dwarfing the multiplier. The constant is coming from the runtime library (or, more accurately, the portions of the runtime library that your program uses). That's relatively fixed so as your Dart program gets larger, the overhead of that becomes relatively smaller. The actual code-size multiplier when going from Dart -> JavaScript is actually fairly small and getting smaller over time. In some cases, we may actually compile Dart code to less JavaScript code because of things like dead code elimination and constant folding. JavaScript code size is something that we consider a core metric for dart2js and we're constantly working to reduce it. |
|