Skip to content

Commit 0d1ca32

Browse files
authored
Stop depending on swift-collections-benchmark (#86)
* Stop depending on swift-collections-benchmark Instead, move the benchmark suite into its own private nested package, under `Benchmarks/`. The recommended way to build & run benchmarks is via the `Utils/run-benchmarks.sh` script, which continues to work as before with this change. * Delete top-level Package.resolved file
1 parent 413ff55 commit 0d1ca32

File tree

7 files changed

+54
-146
lines changed

7 files changed

+54
-146
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
/*.xcodeproj
55
xcuserdata/
66
.*.sw?
7+
/Benchmarks/.swiftpm
8+
/Benchmarks/.build

.swiftpm/xcode/xcshareddata/xcschemes/swift-collections-benchmark.xcscheme

Lines changed: 0 additions & 111 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Benchmarks/Package.swift

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// swift-tools-version:5.3
2+
//===----------------------------------------------------------------------===//
3+
//
4+
// This source file is part of the Swift Collections open source project
5+
//
6+
// Copyright (c) 2021 Apple Inc. and the Swift project authors
7+
// Licensed under Apache License v2.0 with Runtime Library Exception
8+
//
9+
// See https://swift.org/LICENSE.txt for license information
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
import PackageDescription
14+
15+
let package = Package(
16+
name: "swift-collections.Benchmarks",
17+
dependencies: [
18+
.package(name: "swift-collections", path: ".."),
19+
.package(url: "https://github.com/apple/swift-collections-benchmark", from: "0.0.1"),
20+
],
21+
targets: [
22+
.target(
23+
name: "Benchmarks",
24+
dependencies: [
25+
.product(name: "Collections", package: "swift-collections"),
26+
.product(name: "CollectionsBenchmark", package: "swift-collections-benchmark"),
27+
"CppBenchmarks",
28+
],
29+
path: "Benchmarks",
30+
resources: [
31+
.copy("Library.json"),
32+
]
33+
),
34+
.target(
35+
name: "CppBenchmarks",
36+
path: "CppBenchmarks"
37+
),
38+
.target(
39+
name: "benchmark",
40+
dependencies: [
41+
"Benchmarks",
42+
],
43+
path: "benchmark-tool"
44+
),
45+
],
46+
cxxLanguageStandard: .cxx1z
47+
)
File renamed without changes.

Package.swift

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ let package = Package(
5656
.library(name: "OrderedCollections", targets: ["OrderedCollections"]),
5757
.library(name: "PriorityQueueModule", targets: ["PriorityQueueModule"]),
5858
],
59-
dependencies: [
60-
// This is only used in the benchmark executable target.
61-
.package(url: "https://github.com/apple/swift-collections-benchmark", from: "0.0.1"),
62-
],
6359
targets: [
6460
.target(
6561
name: "Collections",
@@ -88,31 +84,6 @@ let package = Package(
8884
dependencies: ["CollectionsTestSupport"],
8985
swiftSettings: settings),
9086

91-
// Benchmarking
92-
.target(
93-
name: "Benchmarks",
94-
dependencies: [
95-
.product(name: "CollectionsBenchmark", package: "swift-collections-benchmark"),
96-
"Collections",
97-
"CppBenchmarks",
98-
],
99-
path: "Benchmarks/Benchmarks",
100-
resources: [
101-
.copy("Library.json"),
102-
]
103-
),
104-
.target(
105-
name: "CppBenchmarks",
106-
path: "Benchmarks/CppBenchmarks"
107-
),
108-
.target(
109-
name: "swift-collections-benchmark",
110-
dependencies: [
111-
"Benchmarks",
112-
],
113-
path: "Benchmarks/swift-collections-benchmark"
114-
),
115-
11687
// Deque<Element>
11788
.target(
11889
name: "DequeModule",
@@ -142,6 +113,5 @@ let package = Package(
142113
name: "PriorityQueueTests",
143114
dependencies: ["PriorityQueueModule"],
144115
swiftSettings: settings),
145-
],
146-
cxxLanguageStandard: .cxx1z
116+
]
147117
)

Utils/run-benchmarks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -eu
44

5-
srcroot="$(dirname "$0")/.."
5+
srcroot="$(dirname "$0")/../Benchmarks"
66
results="batch.results"
77

88
command="${1:-help}"
@@ -12,7 +12,7 @@ run() {
1212
local flags
1313
flags="-c release"
1414
flags="$flags -Xswiftc -Xllvm -Xswiftc -align-module-to-page-size"
15-
swift run --package-path "$srcroot" $flags swift-collections-benchmark "$@"
15+
swift run --package-path "$srcroot" $flags benchmark "$@"
1616
}
1717

1818
case "$command" in

0 commit comments

Comments
 (0)