mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
![]() Constant Sets now have their own classes rather than being constructed as a wrapper over a const Map. The new scheme is similar to Maps - using a ConstantStringSet backed by a JavaScript Object 'dictionary' when the elements are all suitable String values, otherwise using a GeneralConstantSet backed by a list of elements that is converted to a lookup map on demand. Constant Sets and Maps with suitable String keys are backed by a JavaScript Object literal 'dictionary'. The use of the Object literal has been changed so that the property values are no longer the values of the Dart Map, but the position of the key in the order of the entries. The values are provided as a List (Array), so there is an additional indexing operation to access the value on lookup. This does not seem to affect performance. The advantage of the two-level lookup using the 'dictionary' is that Maps with the same keys (in the same order) can share a 'dictionary'. In order to achieve the advantage, the JavaScript Object is modeled as a first class ConstantValue - JavaScriptObjectConstantValue. These changes achieve a code size benefit of -0.90% (~130K) on the main unit of a certain large app, and -0.35% for flute/benchmarks/lib/complex.dart Change-Id: Icad2e6136218486a439e3c5ed0296462e3c3c4e6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310020 Commit-Queue: Stephen Adams <sra@google.com> Reviewed-by: Mayank Patke <fishythefish@google.com> |
||
---|---|---|
.. | ||
lib | ||
test | ||
analysis_options.yaml | ||
LICENSE | ||
OWNERS | ||
pubspec.yaml | ||
README.md |
js_ast
A library for creating JavaScript ASTs from templates.