Skip to content

Conversation

@dcharkes
Copy link
Collaborator

If there are no hooks at all in the package graph, do [...] flutter commands not regress.

Bug: #2236

When there are no hooks, all packages in the dependencies must be checked for hook/build.dart.

This check for Flutter's hello_world takes 1 ms in isolation:

INFO: 2025-05-14 08:30:08.854304: _runPackagesWithHook took 850 us. Checked 8 packages.

Inside Flutter this check (in dart_build) happens concurrently with other code, so it shows up as taking longer:

[        ] [   +1 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have updated contents: /Users/dacoharkes/flt/flutter/examples/hello_world/.dart_tool/package_config_subset} <-- does sync IO
[        ] [   +2 ms] dart_build: Starting due to {}
[        ] [   +1 ms] release_unpack_macos: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have updated contents: /Users/dacoharkes/flt/flutter/packages/flutter_tools/lib/src/build_system/targets/macos.dart,/Users/dacoharkes/flt/flutter/bin/cache/engine.stamp}
[        ] [   +3 ms] check_dev_dependencies_macos: Complete
[        ] [  +11 ms] executing: [/Users/dacoharkes/flt/flutter/examples/hello_world/] /Users/dacoharkes/flt/flutter/bin/cache/dart-sdk/bin/dart pub --suppress-analytics deps --json
[        ] [  +28 ms] No packages with native assets. Skipping native assets compilation.
[        ] [   +2 ms] dart_build: Complete

Because it takes 1 ms, removing the experimental flag in Flutter should not regress flutter run / flutter build.

Alternatives tried but not chosen:

  • We could do sync IO in the hooks_runner, that would make it slightly faster (600 us instead of 800 us for 8 packages), but block anything else happening concurrently.
  • We could do Future.wait for all exists checks concurrently, but this leads to a slowdown for <20 packages when tested locally.

@github-actions
Copy link

PR Health

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/jni/lib/src/third_party/generated_bindings.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

2 similar comments
@github-actions
Copy link

PR Health

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/jni/lib/src/third_party/generated_bindings.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

@github-actions
Copy link

PR Health

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/jni/lib/src/third_party/generated_bindings.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

@coveralls
Copy link

Coverage Status

coverage: 83.694% (+0.009%) from 83.685%
when pulling dec05f9 on no-hooks-speedup
into be5b0dc on main.

Copy link
Contributor

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dcharkes dcharkes merged commit e50a569 into main May 14, 2025
45 checks passed
@dcharkes dcharkes deleted the no-hooks-speedup branch May 14, 2025 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants