Skip to content

Commit

Permalink
Stop depending on swift-collections-benchmark (#86)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
lorentey authored Aug 19, 2021
1 parent 413ff55 commit 0d1ca32
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 146 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
/*.xcodeproj
xcuserdata/
.*.sw?
/Benchmarks/.swiftpm
/Benchmarks/.build

This file was deleted.

4 changes: 2 additions & 2 deletions Package.resolved → Benchmarks/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/apple/swift-argument-parser",
"state": {
"branch": null,
"revision": "986d191f94cec88f6350056da59c2e59e83d1229",
"version": "0.4.3"
"revision": "83b23d940471b313427da226196661856f6ba3e0",
"version": "0.4.4"
}
},
{
Expand Down
47 changes: 47 additions & 0 deletions Benchmarks/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// swift-tools-version:5.3
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//

import PackageDescription

let package = Package(
name: "swift-collections.Benchmarks",
dependencies: [
.package(name: "swift-collections", path: ".."),
.package(url: "https://github.com/apple/swift-collections-benchmark", from: "0.0.1"),
],
targets: [
.target(
name: "Benchmarks",
dependencies: [
.product(name: "Collections", package: "swift-collections"),
.product(name: "CollectionsBenchmark", package: "swift-collections-benchmark"),
"CppBenchmarks",
],
path: "Benchmarks",
resources: [
.copy("Library.json"),
]
),
.target(
name: "CppBenchmarks",
path: "CppBenchmarks"
),
.target(
name: "benchmark",
dependencies: [
"Benchmarks",
],
path: "benchmark-tool"
),
],
cxxLanguageStandard: .cxx1z
)
File renamed without changes.
32 changes: 1 addition & 31 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ let package = Package(
.library(name: "OrderedCollections", targets: ["OrderedCollections"]),
.library(name: "PriorityQueueModule", targets: ["PriorityQueueModule"]),
],
dependencies: [
// This is only used in the benchmark executable target.
.package(url: "https://github.com/apple/swift-collections-benchmark", from: "0.0.1"),
],
targets: [
.target(
name: "Collections",
Expand Down Expand Up @@ -88,31 +84,6 @@ let package = Package(
dependencies: ["CollectionsTestSupport"],
swiftSettings: settings),

// Benchmarking
.target(
name: "Benchmarks",
dependencies: [
.product(name: "CollectionsBenchmark", package: "swift-collections-benchmark"),
"Collections",
"CppBenchmarks",
],
path: "Benchmarks/Benchmarks",
resources: [
.copy("Library.json"),
]
),
.target(
name: "CppBenchmarks",
path: "Benchmarks/CppBenchmarks"
),
.target(
name: "swift-collections-benchmark",
dependencies: [
"Benchmarks",
],
path: "Benchmarks/swift-collections-benchmark"
),

// Deque<Element>
.target(
name: "DequeModule",
Expand Down Expand Up @@ -142,6 +113,5 @@ let package = Package(
name: "PriorityQueueTests",
dependencies: ["PriorityQueueModule"],
swiftSettings: settings),
],
cxxLanguageStandard: .cxx1z
]
)
4 changes: 2 additions & 2 deletions Utils/run-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eu

srcroot="$(dirname "$0")/.."
srcroot="$(dirname "$0")/../Benchmarks"
results="batch.results"

command="${1:-help}"
Expand All @@ -12,7 +12,7 @@ run() {
local flags
flags="-c release"
flags="$flags -Xswiftc -Xllvm -Xswiftc -align-module-to-page-size"
swift run --package-path "$srcroot" $flags swift-collections-benchmark "$@"
swift run --package-path "$srcroot" $flags benchmark "$@"
}

case "$command" in
Expand Down

0 comments on commit 0d1ca32

Please sign in to comment.