You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now that we no longer need to support legacy types:
Remove legacy type check helpers _asBoolS, _asIntS from impacts
Measure and report change in intermediate file sizes in modular compile
Remove legacy type check helpers from rti library
Replace uses options.useLegacySubtyping with false and simplify code
Remove class LegacyType
Remove Recipe.wrapStar and options.printLegacyStars
I'm interested in measuring the intermediate file sizes to see if BackenImpacts.newRtiImpact might be further simplified by omitting elements that are referenced from others.
I was wondering, for the purposes of assessing intermediate file size, if we have a script to run a modular compile?
It seems that pkg/compiler/tools/modular_dart2js.dart no longer works.
I've had some CLs in the works to do some of this cleanup; I'm starting to send some of those out now. https://dart-review.googlesource.com/c/sdk/+/416024 in particular removes LegacyType without coupling it to the larger DartType cleanup.
I'm also working on cleaning up SNS checks, but that requires some coordination with g3.
Before removing the specializations, a sequential compilation looks like this:
Running stage cfe...
Compiled 327,303,689 input bytes (321,520,706 characters source) to 325,597,736 kernel bytes in 215 seconds using 6217.402 MB of memory
Dart file reexported_main_sound.dart compiled to dill: old/out.dill.
Running stage closed-world...
Serialized 325,597,736 input bytes to 111,357,634 bytes data in 91.2 seconds using 5902.305 MB of memory
Dart file old/out.dill serialized to data: old/world.data.
Running stage global-inference...
Serialized 436,955,370 bytes data to 46,629,537 bytes data in 104 seconds using 6393.316 MB of memory
Data files old/out.dill and old/world.data serialized to data: old/global.data.
Running stage codegen...
Serialized 483,584,907 bytes data to 304,476,466 bytes data in 312 seconds using 8656.586 MB of memory
Data files old/out.dill, old/world.data, and old/global.data serialized to codegen data: old/codegen0.
Running stage emit-js...
Compiled 788,061,373 bytes data to 51,991,836 characters JavaScript in 118 seconds using 6557.137 MB of memory
After removing the specializations, it looks like this:
Running stage cfe...
Compiled 327,300,857 input bytes (321,519,232 characters source) to 325,596,248 kernel bytes in 214 seconds using 7023.699 MB of memory
Dart file reexported_main_sound.dart compiled to dill: new/out.dill.
Running stage closed-world...
Serialized 325,596,248 input bytes to 111,357,142 bytes data in 90.9 seconds using 5917.559 MB of memory
Dart file new/out.dill serialized to data: new/world.data.
Running stage global-inference...
Serialized 436,953,390 bytes data to 46,629,197 bytes data in 104 seconds using 6508.672 MB of memory
Data files new/out.dill and new/world.data serialized to data: new/global.data.
Running stage codegen...
Serialized 483,582,587 bytes data to 304,472,915 bytes data in 315 seconds using 8804.633 MB of memory
Data files new/out.dill, new/world.data, and new/global.data serialized to codegen data: new/codegen0.
Running stage emit-js...
Compiled 788,055,502 bytes data to 51,991,292 characters JavaScript in 118 seconds using 6561.238 MB of memory
The input size diff is due to the 1474 characters removed from rti.dart.
out.dill (the output of the cfe stage) is 1488 bytes smaller. world.data (the output of the closed-world stage) is 492 bytes smaller. global.data (the output of the global-inference stage) is 340 bytes smaller. codegen0 (the output of the codegen stage with a single shard) is 3551 bytes smaller.
And we save 544 bytes of JS output.
We can try the same thing on a minimal Dart program where we expect more tree-shaking (literally just void main() {}).
Before removing specializations:
Running stage cfe...
Compiled 10,973,687 input bytes (5,190,704 characters source) to 5,043,848 kernel bytes in 1.71 seconds using 128.453 MB of memory
Dart file main.dart compiled to dill: old/out.dill.
Running stage closed-world...
Serialized 5,043,848 input bytes to 187,429 bytes data in 1.05 seconds using 132.457 MB of memory
Dart file old/out.dill serialized to data: old/world.data.
Running stage global-inference...
Serialized 5,231,277 bytes data to 50,545 bytes data in 1.01 seconds using 105.465 MB of memory
Data files old/out.dill and old/world.data serialized to data: old/global.data.
Running stage codegen...
Serialized 5,281,822 bytes data to 251,149 bytes data in 1.74 seconds using 121.070 MB of memory
Data files old/out.dill, old/world.data, and old/global.data serialized to codegen data: old/codegen0.
Running stage emit-js...
Compiled 5,532,971 bytes data to 4,833 characters JavaScript in 0.72 seconds using 94.941 MB of memory
And after:
Running stage cfe...
Compiled 10,970,855 input bytes (5,189,230 characters source) to 5,042,472 kernel bytes in 1.75 seconds using 128.953 MB of memory
Dart file main.dart compiled to dill: new/out.dill.
Running stage closed-world...
Serialized 5,042,472 input bytes to 187,004 bytes data in 1.09 seconds using 132.957 MB of memory
Dart file new/out.dill serialized to data: new/world.data.
Running stage global-inference...
Serialized 5,229,476 bytes data to 50,229 bytes data in 1.00 seconds using 100.328 MB of memory
Data files new/out.dill and new/world.data serialized to data: new/global.data.
Running stage codegen...
Serialized 5,279,705 bytes data to 247,921 bytes data in 1.88 seconds using 120.570 MB of memory
Data files new/out.dill, new/world.data, and new/global.data serialized to codegen data: new/codegen0.
Running stage emit-js...
Compiled 5,527,626 bytes data to 4,833 characters JavaScript in 0.74 seconds using 98.078 MB of memory
Activity
biggs0125 commentedon Mar 15, 2025
@fishythefish Is already working on replacing dart2js's
DartTypewith the CFE's soLegacyTypewill get removed as part of that change.rakudrama commentedon Mar 17, 2025
I was wondering, for the purposes of assessing intermediate file size, if we have a script to run a modular compile?
It seems that pkg/compiler/tools/modular_dart2js.dart no longer works.
fishythefish commentedon Mar 17, 2025
I've had some CLs in the works to do some of this cleanup; I'm starting to send some of those out now. https://dart-review.googlesource.com/c/sdk/+/416024 in particular removes
LegacyTypewithout coupling it to the largerDartTypecleanup.I'm also working on cleaning up SNS checks, but that requires some coordination with g3.
fishythefish commentedon Mar 19, 2025
I compiled a certain large app (
-O3, minification still enabled) at https://dart-review.googlesource.com/c/sdk/+/416160 and the CL immediately prior.Before removing the specializations, a sequential compilation looks like this:
After removing the specializations, it looks like this:
The input size diff is due to the 1474 characters removed from rti.dart.
out.dill(the output of thecfestage) is 1488 bytes smaller.world.data(the output of theclosed-worldstage) is 492 bytes smaller.global.data(the output of theglobal-inferencestage) is 340 bytes smaller.codegen0(the output of thecodegenstage with a single shard) is 3551 bytes smaller.And we save 544 bytes of JS output.
We can try the same thing on a minimal Dart program where we expect more tree-shaking (literally just
void main() {}).Before removing specializations:
And after:
The savings are similar but not identical.
[dart2js, ddc] Remove LEGACY_TYPE_REF.
[dart2js] Remove LegacyType.
[dart2js, ddc] Remove support for SNS checks.
[dart2js, ddc] Remove PRINT_LEGACY_STARS.
[dart2js, ddc] Remove LEGACY support from rti.
[dart2js] Remove legacy type test specializations.
[dart2js] Remove all uses of `useLegacySubtyping`.
rakudrama commentedon May 5, 2025
I want to leave this bug open as a place to record progress in by miscellaneous cleanup CLs.
[dart2js] Simplify HTypeKnow.isRedundant
[dart2js] Use static type refinement for getters in SSA
[dart2js] Move decision to do static type refinement to dataflow
[dart2js] Remove checks to support migration with mixed null safety
[dart2js] Remove obsolete code from DCE