File tree Expand file tree Collapse file tree 5 files changed +6
-53
lines changed Expand file tree Collapse file tree 5 files changed +6
-53
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ public protocol RegexBenchmark {
88
99public struct Benchmark : RegexBenchmark {
1010 public let name : String
11- let regex : Regex < Substring > // need to figure out this type to allow for other regexes
11+ let regex : Regex < Substring >
1212 let ty : MatchType
1313 let target : String
1414
@@ -72,22 +72,13 @@ public struct BenchmarkRunner {
7272 suite. append ( new)
7373 }
7474
75- // requires the macos13 beta
76- // public func measure() -> Duration {
77- // let clock = SuspendingClock()
78- // var times = (0..<samples).map { _ in clock.measure(run) }
79- // assert(times.count == samples)
80- //
81- // times.sort()
82- // return times[samples/2]
83- // }
84-
8575 func measure( benchmark: some RegexBenchmark ) -> Time {
8676 var times : [ Time ] = [ ]
8777
8878 // initial run to make sure the regex has been compiled
8979 benchmark. run ( )
9080
81+ // fixme: use suspendingclock?
9182 for _ in 0 ..< samples {
9283 let start = Tick . now
9384 benchmark. run ( )
Original file line number Diff line number Diff line change 1- //===----------------------------------------------------------------------===//
2- //
3- // This source file is part of the Swift Collections open source project
4- //
5- // Copyright (c) 2021 Apple Inc. and the Swift project authors
6- // Licensed under Apache License v2.0 with Runtime Library Exception
7- //
8- // See https://swift.org/LICENSE.txt for license information
9- //
10- //===----------------------------------------------------------------------===//
11-
1+ // Taken from swift-collections-benchmark
122import ArgumentParser
133
144public struct Size : RawRepresentable {
Original file line number Diff line number Diff line change 1- //===----------------------------------------------------------------------===//
2- //
3- // This source file is part of the Swift Collections open source project
4- //
5- // Copyright (c) 2021 Apple Inc. and the Swift project authors
6- // Licensed under Apache License v2.0 with Runtime Library Exception
7- //
8- // See https://swift.org/LICENSE.txt for license information
9- //
10- //===----------------------------------------------------------------------===//
11-
1+ // Taken from swift-collections-benchmark
122#if !USE_FOUNDATION_DATE && (os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
133import Foundation // For the side effect of reexporting Darwin/Glibc
144
Original file line number Diff line number Diff line change 1- //===----------------------------------------------------------------------===//
2- //
3- // This source file is part of the Swift Collections open source project
4- //
5- // Copyright (c) 2021 Apple Inc. and the Swift project authors
6- // Licensed under Apache License v2.0 with Runtime Library Exception
7- //
8- // See https://swift.org/LICENSE.txt for license information
9- //
10- //===----------------------------------------------------------------------===//
1+ // Taken from swift-collections-benchmark
112
123import Foundation
134import ArgumentParser
Original file line number Diff line number Diff line change 1- //===----------------------------------------------------------------------===//
2- //
3- // This source file is part of the Swift Collections open source project
4- //
5- // Copyright (c) 2021 Apple Inc. and the Swift project authors
6- // Licensed under Apache License v2.0 with Runtime Library Exception
7- //
8- // See https://swift.org/LICENSE.txt for license information
9- //
10- //===----------------------------------------------------------------------===//
1+ // Taken from swift-collections-benchmark
112
123public struct Timer {
134 internal var _expectNested : Bool ? = nil
You can’t perform that action at this time.
0 commit comments