commit | 180a8f066d52f894877183276f91a7960a9a2c36 | [log] [tgz] |
---|---|---|
author | Jens Johansen <jensj@google.com> | Fri May 16 00:45:34 2025 -0700 |
committer | dart-internal-monorepo <dart-internal-monorepo@dart-ci-internal.iam.gserviceaccount.com> | Fri May 16 00:47:08 2025 -0700 |
tree | 9e9a1fc0337172186db553fddbfbb455cbaa48f0 | |
parent | 54d86670d78d4fb1b37df8e5e2e9ca78bda7c21e [diff] |
[analyzer] Use QueueList by default in SourceFileEdit Adding edits (e.g. via `dart fix --apply` are often done with `List.insert(0, whatnot)` which takes O(n) time. Here QueueList that can insert fast at both ends is used instead (and we use `addFirst` instead of `insert(0)`. On the example from https://github.com/feinstein/google-i18n-address-dart.git we go from: ``` $ time dart fix --use-aot-snapshot --apply [...] 249517 fixes made in 255 files. real 3m55.810s user 4m1.209s sys 0m3.714s (resetting) $ time dart fix --use-aot-snapshot --apply [...] 249517 fixes made in 255 files. real 3m33.966s user 3m37.588s sys 0m2.058s (resetting) $ time dart fix --use-aot-snapshot --apply [...] 249517 fixes made in 255 files. real 3m36.525s user 3m40.083s sys 0m1.907s ``` to: ``` $ time dart fix --use-aot-snapshot --apply [...] 249517 fixes made in 255 files. real 0m9.970s user 0m12.676s sys 0m2.100s (resetting) $ time dart fix --use-aot-snapshot --apply [...] 249517 fixes made in 255 files. real 0m9.862s user 0m12.926s sys 0m1.797s (resetting) $ time dart fix --use-aot-snapshot --apply [...] 249517 fixes made in 255 files. real 0m9.612s user 0m12.712s sys 0m1.834s ``` Statistics on the `real` runtime: ``` N Min Max Median Avg Stddev x 3 213.966 235.81 216.525 222.10033 11.941664 + 3 9.612 9.97 9.862 9.8146667 0.18363369 Difference at 95.0% confidence -212.286 +/- 19.1415 -95.581% +/- 8.61838% (Student's t, pooled s = 8.44503) ``` For `lsp_many_prefer_single_quotes_violations_benchmark.dart --sizes=3200`: Before from something like: ``` Initial analysis: 0.115654 First code action call: 0.835152 Subsequent action call 1: 0.538592 Subsequent action call 2: 0.561636 Select all code action call: 1.564402 ``` After to something like: ``` Initial analysis: 0.086985 First code action call: 0.411660 Subsequent action call 1: 0.171566 Subsequent action call 2: 0.193708 Select all code action call: 1.107339 ``` Statistics on 5 runs gives: First code action call: ``` Difference at 95.0% confidence -0.44381 +/- 0.0261597 -52.4602% +/- 3.09218% (Student's t, pooled s = 0.0179367) ``` Subsequent action call 1: ``` Difference at 95.0% confidence -0.381012 +/- 0.0195618 -69.9139% +/- 3.5895% (Student's t, pooled s = 0.0134128) ``` Subsequent action call 2: ``` Difference at 95.0% confidence -0.360077 +/- 0.0265277 -64.634% +/- 4.76173% (Student's t, pooled s = 0.0181891) ``` Select all code action call: ``` Difference at 95.0% confidence -0.405855 +/- 0.027662 -26.7277% +/- 1.82169% (Student's t, pooled s = 0.0189668) ``` Change-Id: I3868afaa8c32a24c01c3a52bd8a53d5e8e4e3afe Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427401 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> https://dart.googlesource.com/sdk/+/0d4b08caaa711b19903563f3abb9ec436db6eeab
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.