dart-sass
dart-sass copied to clipboard
Use DDC for JS compilation
The Dart dev compiler produces much nicer-looking JavaScript output than dart2js, and makes JavaScript interop much nicer by guaranteeing that all Dart objects can be used directly in JS without extra wrappers. This will be very useful for custom functions, which will need to be able to interact with SassScript values with as little overhead as possible.
This is currently blocked on dart-lang/sdk#27607.
@nex3: I imagine though you'd still want dart2js for the "binary", right?
i.e. dart-sass.js (dart2js) and dart-sass.debug.js (using DDC)
I'd rather avoid shipping two copies of the compiled codebase. @jmesserly was saying that they'll probably be comparably fast if we avoid dynamic dispatch.
It should be in the same ballpark, yeah, but worth verifying that.
Where it may fall behind are places where dart2js type inference knows more than the Dart types in the program. For example dart2js knows something is never null but DDC doesn't (DDC has some limited local nullable type inference that helps somewhat). It's also possible that DDC's covariance checks will prove to be expensive (dart2js needs them too but has more type test optimizations). I was hoping for a sufficiently expressive type system that null checks and type checks could be avoided if the developer wishes, but we're unfortunately not there yet.