Repository navigation
v2.12.2: faster ClassProxy generation (index the resolver's classes once per build step) - #60
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lassProxy lookup findCandidateClassElements collected the classes of every resolver library (thousands, SDK and packages included) for each ClassProxy. They are now indexed by name once per build step, each library when first seen (the resolver gets more libraries as more are resolved), so the candidates are the same as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #60 +/- ##
=======================================
Coverage 93.54% 93.55%
=======================================
Files 14 14
Lines 6538 6544 +6
=======================================
+ Hits 6116 6122 +6
Misses 422 422
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
To find the target class of a
ClassProxy,InputAnalyzerResolved.findCandidateClassElementslisted every library known to the resolver (thousands: the SDK and all the packages) and collected all their classes, then searched by name. It did this again for eachClassProxy.In a project with 69
ClassProxys in one library, that library took 4.5s of the builder's ~7s of "building". About 3.7s of it went to collecting classes (~53ms per proxy, over ~2,400 libraries).Fix
InputAnalyzerResolved), each library when it's first seen. The resolver gets more libraries as more are resolved (630 → 2,410 after the first proxy here), so each call still reads the resolver's current library list, at the same point as before, and indexes only the new ones.Measured
Clean
build_runner buildof that project, local, on AC power, 2 runs each:Built with build_runner/aot inWhat's left, for the record:
@EnableReflectionclasses (~0.8s).Also
ClassProxys in one library, the second with alibraryPaththat brings in libraries the first one didn't index.dart analyze --fatal-infosclean.🤖 Generated with Claude Code