commit | d6aeaf8a9be05f0b7d7c7fd0e9b922573477a8a1 | [log] [tgz] |
---|---|---|
author | Jens Johansen <jensj@google.com> | Wed Feb 05 03:04:24 2025 -0800 |
committer | dart-internal-monorepo <dart-internal-monorepo@dart-ci-internal.iam.gserviceaccount.com> | Wed Feb 05 03:07:00 2025 -0800 |
tree | 69c9ffc6ea649b626a44e8def10b672f5c10c5ac | |
parent | a5c07d237c8492ae7e634d604b0bc53ab2032604 [diff] |
[scanner] Optimize scanning of identifiers, comments, spaces etc. In bytes per microsecond, statistics on 25 runs each of an AOT compile scanner_benchmarker run with `pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart --bytes`: ``` N Min Max Median Avg Stddev x 25 116.01859 118.24483 117.63414 117.41239 0.6246963 + 25 136.5563 139.73077 138.82117 138.72373 0.75137577 Difference at 95.0% confidence 21.3113 +/- 0.393007 18.1508% +/- 0.334724% (Student's t, pooled s = 0.690945) ``` With `--string`: ``` N Min Max Median Avg Stddev x 25 104.77452 118.00444 115.83707 115.04005 2.8653416 + 25 120.1637 125.80937 123.84278 123.88533 1.2858698 Difference at 95.0% confidence 8.84528 +/- 1.26317 7.68887% +/- 1.09802% (Student's t, pooled s = 2.22077) ``` And running it through the benchmarker (`pkg/front_end/tool/benchmarker.dart --cache --silent --iterations=25`): `--bytes`: ``` msec task-clock:u: -15.4177% +/- 0.3838% (-515.18 +/- 12.83) cycles:u: -15.5303% +/- 0.3716% (-2263042219.68 +/- 54143984.97) instructions:u: -11.8786% +/- 0.0000% (-3721971162.16 +/- 292.14) branch-misses:u: -13.0375% +/- 0.8048% (-10550278.80 +/- 651299.13) seconds time elapsed: -15.4170% +/- 0.3820% (-0.52 +/- 0.01) seconds user: -15.4936% +/- 0.3859% (-0.51 +/- 0.01) msec task-clock:u: -15.1724% +/- 0.3173% (-505.72 +/- 10.58) L1-icache-load-misses: 42.3794% +/- 6.4906% (1901929.52 +/- 291287.30) LLC-loads: 3.2837% +/- 0.7535% (40264.52 +/- 9239.86) LLC-load-misses: -2.2808% +/- 1.3789% (-3647.96 +/- 2205.39) seconds time elapsed: -15.1722% +/- 0.3201% (-0.51 +/- 0.01) seconds user: -15.1811% +/- 0.3196% (-0.50 +/- 0.01) ``` `--string`: ``` msec task-clock:u: -6.2018% +/- 0.3384% (-207.18 +/- 11.31) cycles:u: -6.2315% +/- 0.3257% (-907517140.20 +/- 47432247.03) instructions:u: -7.2693% +/- 0.0000% (-2325765423.72 +/- 491.22) branch-misses:u: -2.6467% +/- 0.6289% (-2198552.96 +/- 522409.28) seconds time elapsed: -6.1995% +/- 0.3378% (-0.21 +/- 0.01) seconds user: -6.2612% +/- 0.3705% (-0.21 +/- 0.01) msec task-clock:u: -6.1645% +/- 0.4224% (-206.18 +/- 14.13) L1-icache-load-misses: 40.5703% +/- 6.3952% (1945020.52 +/- 306599.42) LLC-loads: 1.5464% +/- 0.8925% (20130.04 +/- 11618.51) seconds time elapsed: -6.1656% +/- 0.4197% (-0.21 +/- 0.01) seconds user: -6.1980% +/- 0.4240% (-0.21 +/- 0.01) ``` And compiling the CFE from December with the CFE, statistics on 50 runs each, again run with `--cache --silent` (so 2 x 50 runs each): ``` msec task-clock:u: -0.7401% +/- 0.1900% (-45.01 +/- 11.56) cycles:u: -0.7971% +/- 0.1917% (-202488820.10 +/- 48684812.34) instructions:u: -0.5975% +/- 0.0004% (-184367556.38 +/- 137673.23) branch-misses:u: -2.9490% +/- 0.8146% (-2788427.60 +/- 770259.65) seconds time elapsed: -0.7428% +/- 0.1901% (-0.05 +/- 0.01) seconds user: -0.7148% +/- 0.2895% (-0.04 +/- 0.02) L1-icache-load-misses: 0.1974% +/- 0.1457% (954253.92 +/- 704297.81) LLC-loads: 0.1988% +/- 0.1244% (97594.22 +/- 61084.80) ``` Change-Id: I0550596f5320a1ff00d85765c121d012f55bec61 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407400 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Jens Johansen <jensj@google.com> https://dart.googlesource.com/sdk/+/95265c319c101636e15e36d36f26e7836e8bfe18
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.