dart2js: smaller huge const maps #17579
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
dart2js-optimization
type-enhancement
A request for a change that isn't a bug
web-dart2js
const maps have some redundancy:
const {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}
--->
C.List_8xz = Isolate.makeConstantList(["a", "b", "c", "d", "e"]);
C.Map_8x6Jr = new H.ConstantStringMap(5, {a: 1, b: 2, c: 3, d: 4, e: 5}, C.List_8xz);
Instead of parsing and constructing the object literal, the JS code could call a helper that takes a keys list and a values list.
C.List_8xz = Isolate.makeConstantList(["a", "b", "c", "d", "e"]);
C.Map_8x6Jr = Isolate.makeConstantStringMap(C.List_8xz, [1, 2, 3, 4, 5]);
The space saving is roughly the accumulated length of the keys, provided 'makeConstantStringMap' is minified.
The text was updated successfully, but these errors were encountered: