Skip to content

Conversation

JordonPhillips
Copy link
Contributor

@JordonPhillips JordonPhillips commented Sep 10, 2025

This adds a new DependencyGraph to smithy-utils, intended for use in the numerous locations where we perform topological sorts.

Performance-wise, it's a bit faster for dense graphs (integrations with lots of dependencies) and a bit slower for sparse graphs. In the sizes we're realistically looking at for integrations (dozens, tops) the difference is insignificant. We're talking about a microsecond or two.

Here's benchmarking output for the old integration sort:
Screenshot 2025-09-11 at 10 32 58

And here's output for the new:
Screenshot 2025-09-11 at 10 26 08

I also plan to add the same sort of ordering capabilities to smithy build plugins, which is why I've gone to the trouble to make this generic.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@JordonPhillips JordonPhillips requested a review from a team as a code owner September 10, 2025 21:26
@JordonPhillips JordonPhillips marked this pull request as draft September 10, 2025 21:26
{
"type": "feature",
"description": "Add a generic dependency graph to smithy-utils to be used for sorting various dependent objects, such as integrations and plugins.",
"pull_requests": []
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I gotta update this

@JordonPhillips JordonPhillips force-pushed the plugin-ordering branch 2 times, most recently from 4bd3c5b to 0a992d7 Compare September 12, 2025 14:00
@JordonPhillips JordonPhillips marked this pull request as ready for review September 17, 2025 14:47
This adds a generic dependency graph to smithy-utils. This is intended
to be used to sort SmithyIntegrations, SmithyBuildPlugins, and
anything else that needs a topological sort.
This updates the SmithyIntegration sorting to use the generic
DependencyGraph. It also adds some benchmarking configurations,
which show a minor speed bump for highly dependent integrations
and a major speed bump for highly independent integrations.
This adds the concept of dependencies to build plugins. Plugins can
now declare that they must be run before or after some plugins. This
uses the same dependency graph that is used by SmithyIntegration, but
unlike integrations there is no concept of a "priority". This is
because we may want to be able to run the plugins themselves in
parallell, and such a priority would complicate that.
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.

2 participants