Skip to content

Conversation

@davidmorgan
Copy link
Contributor

@davidmorgan davidmorgan commented Nov 13, 2025

The benchmark in #4280 shows another quadratic scaling problem: in the number of library cycles.

The code is currently doing work for every already-loaded library cycle for every library cycle.

A simple change only does the work for deps that are actually needed.

Edit+incremental build on "random" benchmark before this PR, aot

1000,2000,3000,4000,5000
5.17,24.8,83.22,217.17,424.04

Edit+incremental build on "random" benchmark after this PR, aot

1000,2000,3000,4000,5000
2.89,4.92,7.75,11.07,15.35
8j9fSNjWcErkMTU

@github-actions
Copy link

github-actions bot commented Nov 13, 2025

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

@davidmorgan davidmorgan force-pushed the optimize-library-cycles branch from 45100ad to cba613f Compare November 13, 2025 16:13
@davidmorgan davidmorgan marked this pull request as ready for review November 13, 2025 16:24
@davidmorgan davidmorgan requested a review from jensjoha November 13, 2025 16:24
@gmpassos
Copy link

gmpassos commented Nov 13, 2025

The yellow line in the chart was so low I only noticed it when I read the legend 😂

👏🏻👏🏻👏🏻

///
/// A [_graphs] entry will be created for each ID in [newCycles].
void _buildGraphs(int phase, {required List<LibraryCycle> newCycles}) {
// Build lookup from ID to [LibraryCycle] including new and existing cycles.

Choose a reason for hiding this comment

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

Am I reading this right, that this boils down to not pre-populating the map?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, exactly :)

@davidmorgan davidmorgan merged commit 8f6a7b5 into dart-lang:master Nov 14, 2025
36 checks passed
@davidmorgan davidmorgan deleted the optimize-library-cycles branch November 14, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants