diff --git a/Benchmarks/Benchmarks/PackageGraphBenchmarks/PackageGraphBenchmarks.swift b/Benchmarks/Benchmarks/PackageGraphBenchmarks/PackageGraphBenchmarks.swift index 1c4d38061e4..bab1f4af582 100644 --- a/Benchmarks/Benchmarks/PackageGraphBenchmarks/PackageGraphBenchmarks.swift +++ b/Benchmarks/Benchmarks/PackageGraphBenchmarks/PackageGraphBenchmarks.swift @@ -27,7 +27,7 @@ let benchmarks = { let parsedValue = Int(envVar) { modulesGraphDepth = parsedValue } else { - modulesGraphDepth = 100 + modulesGraphDepth = 150 } let modulesGraphWidth: Int @@ -35,7 +35,7 @@ let benchmarks = { let parsedValue = Int(envVar) { modulesGraphWidth = parsedValue } else { - modulesGraphWidth = 100 + modulesGraphWidth = 150 } let packagesGraphDepth: Int @@ -46,8 +46,6 @@ let benchmarks = { packagesGraphDepth = 10 } - let noopObservability = ObservabilitySystem.NOOP - // Benchmarks computation of a resolved graph of modules for a package using `Workspace` as an entry point. It runs PubGrub to get // resolved concrete versions of dependencies, assigning all modules and products to each other as corresponding dependencies // with their build triples, but with the build plan not yet constructed. In this benchmark specifically we're loading `Package.swift` @@ -67,55 +65,120 @@ let benchmarks = { let workspace = try Workspace(fileSystem: localFileSystem, location: .init(forRootPackage: path, fileSystem: localFileSystem)) for _ in benchmark.scaledIterations { - try workspace.loadPackageGraph(rootPath: path, observabilityScope: noopObservability) + try workspace.loadPackageGraph(rootPath: path, observabilityScope: ObservabilitySystem.NOOP) } } - - // Benchmarks computation of a resolved graph of modules for a synthesized package using `loadModulesGraph` as an - // entry point, which almost immediately delegates to `ModulesGraph.load` under the hood. + // Benchmarks computation of a resolved graph of modules for a trivial synthesized package using `loadModulesGraph` + // as an entry point, which almost immediately delegates to `ModulesGraph.load` under the hood. Benchmark( "SyntheticModulesGraph", configuration: .init( metrics: defaultMetrics, maxDuration: .seconds(10), thresholds: [ - .mallocCountTotal: .init(absolute: [.p90: 2500]), - .syscalls: .init(absolute: [.p90: 0]), + .mallocCountTotal: .init(absolute: [.p90: 17000]), + .syscalls: .init(absolute: [.p90: 5]), ] ) ) { benchmark in - let targets = try (0.. TargetDescription in + let dependencies = (0.. [TargetDescription.Dependency] in + if includeMacros { + [.target(name: "Module\(i)"), .target(name: "Macros\(i)")] + } else { + [.target(name: "Module\(i)")] + } + } + return try TargetDescription(name: "Module\(i)", dependencies: dependencies) + } + + let macrosModules: [TargetDescription] + let macrosDependenciesModules: [TargetDescription] + if includeMacros { + macrosModules = try (0..