commit | 15659d368994287b346f1ccf7fa59b9355880728 | [log] [tgz] |
---|---|---|
author | Jens Johansen <jensj@google.com> | Tue Sep 17 07:00:41 2024 +0000 |
committer | dart-internal-monorepo <dart-internal-monorepo@dart-ci-internal.iam.gserviceaccount.com> | Tue Sep 17 00:02:34 2024 -0700 |
tree | a3e3716eef4989ac87565a939d35c29e51387294 | |
parent | 333a8746a5584a259435485668fa957c7d893c8f [diff] |
[parser] Replace `optional` for some calls This CL replaces the `optional` call in some places (more will likely follow in follow-up-CLs) with the (badly named) `optional2` which is both better typed (doesn't use strings) and is faster. In this CL I've replaced the most used calls (when using the CFE to compile itself), saving ~100 mio instructions. Sometimes statistics just says the ~100 mio instructions saved, other times I get statistics like this: ``` msec task-clock:u: -0.6861% +/- 0.2300% (-28.64 +/- 9.60) page-faults:u: 0.1113% +/- 0.0114% (116.33 +/- 11.97) cycles:u: -0.7966% +/- 0.2280% (-137543215.11 +/- 39365289.96) instructions:u: -0.4655% +/- 0.0003% (-100120984.16 +/- 56848.83) branch-misses:u: -3.5671% +/- 0.8585% (-2249707.82 +/- 541442.75) seconds time elapsed: -0.6788% +/- 0.2307% (-0.03 +/- 0.01) seconds user: -0.8448% +/- 0.2950% (-0.03 +/- 0.01) ``` ``` msec task-clock:u: -0.4102% +/- 0.2224% (-17.29 +/- 9.37) page-faults:u: 0.1194% +/- 0.0130% (124.99 +/- 13.61) cycles:u: -0.4368% +/- 0.2296% (-75891577.97 +/- 39893793.33) instructions:u: -0.4658% +/- 0.0003% (-100182606.12 +/- 62071.96) branch-misses:u: -1.5890% +/- 0.9771% (-1012729.95 +/- 622739.88) seconds time elapsed: -0.4072% +/- 0.2224% (-0.02 +/- 0.01) seconds user: -0.4771% +/- 0.3049% (-0.02 +/- 0.01) ``` ``` msec task-clock:u: -0.4542% +/- 0.2160% (-19.18 +/- 9.12) page-faults:u: 0.1219% +/- 0.0115% (127.61 +/- 12.03) cycles:u: -0.4774% +/- 0.2225% (-83126015.12 +/- 38752062.54) instructions:u: -0.4658% +/- 0.0003% (-100174778.84 +/- 61310.55) branch-misses:u: -1.9576% +/- 0.9711% (-1253736.65 +/- 621904.22) seconds time elapsed: -0.4471% +/- 0.2160% (-0.02 +/- 0.01) seconds user: -0.4976% +/- 0.2645% (-0.02 +/- 0.01) ``` These are statistics on 100 runs (each) of the CFE compiling itself when run as an AOT compile with `--deterministic`. It seems likely that it saves something like 0.4% in both instructions, cycles and actual runtime. Change-Id: I12763c23b1ec33357a31aaf47ed93ca16264c0f7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385160 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> https://dart.googlesource.com/sdk/+/dfb414a0ec54709a9561e61605a8d30af7ea1b21
Monorepo is:
With depot_tools installed and on your path, create a directory for your monorepo checkout and run these commands to create a gclient solution in that directory:
mkdir monorepo cd monorepo gclient config --unmanaged https://dart.googlesource.com/monorepo gclient sync -D
This gives you a checkout in the monorepo directory that contains:
monorepo/ DEPS - the DEPS used for this gclient checkout commits.json - the pinned commits for Dart, flutter/engine, and flutter/flutter tools/ - scripts used to create monorepo DEPS engine/src/ - the flutter/buildroot repo flutter/ - the flutter/engine repo out/ - the build directory, where Flutter engine builds are created third_party/ - Flutter dependencies checked out by DEPS dart/ - the Dart SDK checkout. third_party - Dart dependencies, also used by Flutter flutter/ - the flutter/flutter repo
Flutter's instructions for building the engine are at Compiling the engine
They can be followed closely, with a few changes:
goma_ctl ensure_start
is sufficient.Example build commands that work on linux:
MONOREPO_PATH=$PWD if [[ ! $PATH =~ (^|:)$MONOREPO_PATH/flutter/bin(:|$) ]]; then PATH=$MONOREPO_PATH/flutter/bin:$PATH fi export GOMA_DIR=$(dirname $(command -v gclient))/.cipd_bin goma_ctl ensure_start pushd engine/src flutter/tools/gn --goma --no-prebuilt-dart-sdk --unoptimized --full-dart-sdk autoninja -C out/host_debug_unopt popd
The Flutter commands used to build and run apps will use the locally built Flutter engine and Dart SDK, instead of the one downloaded by the Flutter tool, if the --local-engine
option is provided.
For example, to build and run the Flutter spinning square sample on the web platform,
MONOREPO_PATH=$PWD cd flutter/examples/layers flutter --local-engine=host_debug_unopt \ -d chrome run widgets/spinning_square.dart cd $MONOREPO_PATH
To build for desktop, specify the desktop platform device in flutter run
as -d macos
or -d linux
or -d windows
. You may also need to run the command
flutter create --platforms=windows,macos,linux
on existing apps, such as sample apps. New apps created with flutter create
already include these support files. Details of desktop support are at Desktop Support for Flutter
Tests in the Flutter source tree can be run with the flutter test
command, run in the directory of a package containing tests. For example:
MONOREPO_PATH=$PWD cd flutter/packages/flutter flutter test --local-engine=host_debug_unopt cd $MONOREPO_PATH
Please file an issue or email the dart-engprod team with any problems with or questions about using monorepo.
We will update this documentation to address them.
flutter
commands may download the engine and Dart SDK files for the configured channel, even though they will be using the local engine and its SDK.gclient sync
needs to be run in an administrator session, because some installed dependencies create symlinks.