[M] Change in dart/sdk[main]: analyzer: Cache analysis options during _ContextLocator tasks

0 views
Skip to first unread message

Konstantin Shcheglov (Gerrit)

unread,
2:50 PM (6 hours ago) 2:50 PM
to Samuel Rawlins, Brian Wilkerson, Danny Tuppeny, Commit Queue, dart-analys...@google.com, rev...@dartlang.org
Attention needed from Samuel Rawlins

Konstantin Shcheglov voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Samuel Rawlins
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I17cad3e73a5d8352b95b664bd6fa09bccddbdd2d
Gerrit-Change-Number: 491700
Gerrit-PatchSet: 2
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-CC: Brian Wilkerson <brianwi...@google.com>
Gerrit-CC: Danny Tuppeny <da...@tuppeny.com>
Gerrit-Attention: Samuel Rawlins <sraw...@google.com>
Gerrit-Comment-Date: Mon, 30 Mar 2026 18:50:12 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Samuel Rawlins (Gerrit)

unread,
5:03 PM (4 hours ago) 5:03 PM
to Konstantin Shcheglov, Brian Wilkerson, Danny Tuppeny, Commit Queue, dart-analys...@google.com, rev...@dartlang.org

Samuel Rawlins voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I17cad3e73a5d8352b95b664bd6fa09bccddbdd2d
Gerrit-Change-Number: 491700
Gerrit-PatchSet: 2
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-CC: Brian Wilkerson <brianwi...@google.com>
Gerrit-CC: Danny Tuppeny <da...@tuppeny.com>
Gerrit-Comment-Date: Mon, 30 Mar 2026 21:03:32 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Commit Queue (Gerrit)

unread,
5:03 PM (4 hours ago) 5:03 PM
to Samuel Rawlins, Konstantin Shcheglov, Brian Wilkerson, Danny Tuppeny, dart-analys...@google.com, rev...@dartlang.org

Commit Queue submitted the change

Change information

Commit message:
analyzer: Cache analysis options during _ContextLocator tasks

Work towards https://github.com/dart-lang/sdk/issues/62539

I won't say it's fixed yet, because this only cuts down writes by half, that I can see.

The idea is that _ContextLocator has a set of analysis option caches.
Each cache is stored in a map, mapped from each SourceFactory (for
resolving 'package:' URIs.

I forked the bulk of `getOptionsFromSource` into a private
method `_getOptionsFromSource`, which has two extra parameters:
`required Set<Source> handled` and
`required Map<Uri, YamlMap> optionsCache`, to make sure that those are
_always_ passed in recursive calls, and that they are minimally exposed
in public API.

These caches are not long-lived; they only exist during
ContextLocator's work, and are then garbage-collected. Because of this,
we do not need to be concerned with files changing on disk or in an
OverlayResourceProvider. _ContextLocator is not re-entrant because the
only public API into that class is the top-level `locateContextRoots`
function.

There may be more caching opportunities, I think specifically in
ContextBuilderImpl and in the options validation code.
Change-Id: I17cad3e73a5d8352b95b664bd6fa09bccddbdd2d
Reviewed-by: Konstantin Shcheglov <sche...@google.com>
Commit-Queue: Samuel Rawlins <sraw...@google.com>
Files:
  • M pkg/analyzer/lib/src/analysis_options/analysis_options_provider.dart
  • M pkg/analyzer/lib/src/dart/analysis/context_builder.dart
  • M pkg/analyzer/lib/src/dart/analysis/context_locator.dart
Change size: M
Delta: 3 files changed, 110 insertions(+), 65 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Konstantin Shcheglov
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I17cad3e73a5d8352b95b664bd6fa09bccddbdd2d
Gerrit-Change-Number: 491700
Gerrit-PatchSet: 3
Gerrit-Owner: Samuel Rawlins <sraw...@google.com>
Gerrit-Reviewer: Konstantin Shcheglov <sche...@google.com>
Gerrit-Reviewer: Samuel Rawlins <sraw...@google.com>
Gerrit-CC: Brian Wilkerson <brianwi...@google.com>
Gerrit-CC: Danny Tuppeny <da...@tuppeny.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages