Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Stop supporting a built-in chart library
  • Loading branch information
lorentey committed May 21, 2025
commit b306c88e1407428592c51a867ff5082b58f272ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2021 Apple Inc. and the Swift project authors
// Copyright (c) 2021 - 2025 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
Expand Down Expand Up @@ -47,14 +47,8 @@ extension Benchmark.ChartLibrary {
}

extension Benchmark {
internal func _loadLibrary(_ path: FilePath?) throws -> ChartLibrary {
if let path = path {
return try Benchmark.ChartLibrary.load(from: path)
}
if let library = self.chartLibrary {
return library
}
throw Benchmark.Error("No predefined library configuration")
internal func _loadLibrary(_ path: FilePath) throws -> ChartLibrary {
try Benchmark.ChartLibrary.load(from: path)
}
}

Expand Down
4 changes: 1 addition & 3 deletions Sources/CollectionsBenchmark/Benchmark/Benchmark.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift Collections open source project
//
// Copyright (c) 2021 Apple Inc. and the Swift project authors
// Copyright (c) 2021 - 2025 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
Expand All @@ -17,8 +17,6 @@ public struct Benchmark {
internal var _inputGenerators: [_TypeBox: (Int) -> Any] = [:]
private let _executionContext = _ExecutionContext.shared

public var chartLibrary: ChartLibrary? = nil

public init(title: String = "") {
self.title = title
registerInputGenerator(for: Int.self) { size in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ extension _BenchmarkCLI.Library {
}

@Option(
help: "Path to a library configuration file in JSON format. (default: built-in library)",
help: "Path to a library configuration file in JSON format.",
completion: .file(extensions: ["json"]),
transform: { str in FilePath(str) })
var library: FilePath?
var library: FilePath

@Flag(help: "List all tasks included in the library.")
var tasks = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ extension _BenchmarkCLI.Library {
}

@Option(
help: "Path to a library configuration file in JSON format. (default: built-in library)",
help: "Path to a library configuration file in JSON format.",
completion: .file(extensions: ["json"]),
transform: { str in FilePath(str) })
var library: FilePath?
var library: FilePath

@Argument(
help: "A path to a benchmark results document.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ extension _BenchmarkCLI.Library {
}

@Option(
help: "Path to a library configuration file in JSON format. (default: built-in library)",
help: "Path to a library configuration file in JSON format.",
completion: .file(extensions: ["json"]),
transform: { str in FilePath(str) })
internal var library: FilePath?
internal var library: FilePath

@Argument(
help: "Output filename.",
Expand Down