Repository navigation
Add benchmarks and render Package.swift 5x faster - #32
Merged
Merged
Conversation
Move renderSingleTarget, generateTargetsSection and the dependency graph metrics into PackagePlugin-free files that report warnings through a closure, and add renderPackageContent for the whole generated text. The tests now link them and cover the rendered file byte for byte. Output is unchanged.
A separate Benchmarks/ package links the plugin's PackagePlugin-free files and measures config decoding, import filtering, the dependency graph and rendering on a synthetic 1,000-target project. Includes the p50 and hotspots tools and scripts/profile.sh. CI builds the benchmarks.
Compute each target's pragma-mark group once instead of in the sort comparator, build the Apple SDK set once instead of per target, and count local dependencies without building arrays. Output is byte for byte the same. Document the benchmarks and results in docs/performance.md.
This was referenced Nov 14, 2026
Merged
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.
Stacked on #31 (base
chore/architecture-rules); GitHub retargets it tomainonce #31 merges.What
renderSingleTarget,generateTargetsSectionand the dependency-graph metrics moved out ofPackagePluginfiles intoTargetRendering.swiftandDependencyGraph.swift, which report warnings through a closure. NewrenderPackageContentbuilds the whole generated text;writeOutputnow calls it.filterImportstakes an optionalremarkclosure instead ofverbose:. The test target links the new files, andTargetRenderingTestschecks a whole rendered file byte for byte.Benchmarks/, a separate package on ordo-one/package-benchmark. It links the same pure files and runs them on a synthetic 1,000-target project (config decode, import filtering, dependency graph, products, wholePackage.swift). Also includes thep50/hotspotstools andscripts/profile.sh. CI builds it without running it (jemalloc disabled on the runner).generateTargetsSectioncalledpragmaMarkGroupNametwice per comparison, which was 50% of render time. The group is now computed once per target.renderSingleTargetrebuiltSet(appleDefaultSDKs)(272 strings) for every target. It now usesappleDefaultSDKSet, built once.count(where:)/contains(where:)instead of filtering into arrays in the graph metrics.Sharedlinks, and the SDK-filtering rule knows the new set.Before → after (p50, 1,000 targets, Apple silicon)
Output is unchanged
cmpon the 1.1 MB synthetic render (both configs, warnings, graph metrics, decoded config) gives the same bytes before and after.mainand from this branch, and the generatedPackage_generated.swiftfiles are identical.swift test(27 tests) andswift test --package-path Architecturepass.This deserves a patch release (1.0.6) once merged. I could not merge it because branch protection requires a review.