DescriptionAdd support for profile-based startup optimizations.
An experimental (and undocumented) flag '--experimental-track-allocations' makes the '--fast-startup' compiler add instructions that track which classes are allocated.
By going to the JavaScript console and dumping this information as JSON into `allocated_classes_profile` the next dart2js compilation can optimize the startup by deferring the initialization of the classes that weren't necessary for startup.
The workflow would look something like:
```
dart2js --fast-startup --experimental-track-allocations -o foo.js -o foo.dart
// Run the program in Chrome and run the following command in the console:
JSON.stringify($__dart_deferred_initializers__.allocations)
// Take the result and copy it into a file, say "allocations.json".
// Then rerun the compilation with the allocation-information.
dart2js --experimental-allocations-path=allocations.json --fast-startup -o foo.js -o foo.dart
```
R=sra@google.com
Committed: https://github.com/dart-lang/sdk/commit/237313b0279c36e247f147e722d0c3f38e38f6fa
Patch Set 1 #Patch Set 2 : Fix forgotten cleanup. #
Total comments: 8
Patch Set 3 : Rebase #Patch Set 4 : Address comments. #
Messages
Total messages: 9 (4 generated)
|