Skip to content

Add simple synthetic modules graph benchmarks #7465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Apr 17, 2024

New SyntheticModulesGraph benchmark is introduced, which calls loadModulesGraph function that we already run against test fixtures in ModulesGraphTests and BuildPlanTests. The function under benchmark almost immediately delegates to ModulesGraph.load, which is used in real-world modules graph dependency resolution.

Benchmark parameters are controlled with SWIFTPM_BENCHMARK_MODULES_GRAPH_DEPTH and SWIFTPM_BENCHMARK_MODULES_GRAPH_WIDTH environment variables, so in the future we should be able to plot graphs of benchmark metrics against depth and width of modules graph over a given range.

Thresholds are now split into platform-specific directories so that thresholds recorded on x86_64 don't interfere with thresholds for arm64, same for the OS family.

@MaxDesiatov MaxDesiatov added test suite improvements to SwiftPM test suite no functional change No user-visible functional changes included performance Performance optimizations and improvements modules graph Modules dependency resolution labels Apr 17, 2024
@MaxDesiatov MaxDesiatov requested a review from xedin April 17, 2024 16:19
@MaxDesiatov MaxDesiatov self-assigned this Apr 17, 2024
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@@ -13,16 +13,17 @@
import struct DequeModule.Deque

/// Directed graph that stores edges in [adjacency lists](https://en.wikipedia.org/wiki/Adjacency_list).
struct DirectedGraph<Node> {
init(nodes: [Node]) {
@_spi(DontAdoptOutsideOfSwiftPMExposedForBenchmarksAndTestsOnly)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think @_spi(Testing) or something similar is clear enough :)

@MaxDesiatov MaxDesiatov merged commit 9672bba into main Apr 18, 2024
5 checks passed
@MaxDesiatov MaxDesiatov deleted the maxd/synthetic-modules-benchmark branch April 18, 2024 02:44
bnbarham added a commit to bnbarham/swift-package-manager that referenced this pull request Apr 18, 2024
SPI was added here in swiftlang#7465, but missed adding it to this module.
MaxDesiatov added a commit that referenced this pull request Apr 18, 2024
SPI was added here in #7465, but missed adding it to this module.

---------

Co-authored-by: Max Desiatov <m_desiatov@apple.com>
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
New `SyntheticModulesGraph` benchmark is introduced, which calls
`loadModulesGraph` function that we already run against test fixtures in
`ModulesGraphTests` and `BuildPlanTests`. The function under benchmark
almost immediately delegates to `ModulesGraph.load`, which is used in
real-world modules graph dependency resolution.

Benchmark parameters are controlled with
`SWIFTPM_BENCHMARK_MODULES_GRAPH_DEPTH` and
`SWIFTPM_BENCHMARK_MODULES_GRAPH_WIDTH` environment variables, so in the
future we should be able to plot graphs of benchmark metrics against
depth and width of modules graph over a given range.

Thresholds are now split into platform-specific directories so that
thresholds recorded on x86_64 don't interfere with thresholds for arm64,
same for the OS family.
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
SPI was added here in swiftlang#7465, but missed adding it to this module.

---------

Co-authored-by: Max Desiatov <m_desiatov@apple.com>
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
New `SyntheticModulesGraph` benchmark is introduced, which calls
`loadModulesGraph` function that we already run against test fixtures in
`ModulesGraphTests` and `BuildPlanTests`. The function under benchmark
almost immediately delegates to `ModulesGraph.load`, which is used in
real-world modules graph dependency resolution.

Benchmark parameters are controlled with
`SWIFTPM_BENCHMARK_MODULES_GRAPH_DEPTH` and
`SWIFTPM_BENCHMARK_MODULES_GRAPH_WIDTH` environment variables, so in the
future we should be able to plot graphs of benchmark metrics against
depth and width of modules graph over a given range.

Thresholds are now split into platform-specific directories so that
thresholds recorded on x86_64 don't interfere with thresholds for arm64,
same for the OS family.
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
SPI was added here in swiftlang#7465, but missed adding it to this module.

---------

Co-authored-by: Max Desiatov <m_desiatov@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
modules graph Modules dependency resolution no functional change No user-visible functional changes included performance Performance optimizations and improvements test suite improvements to SwiftPM test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants