File tree 5 files changed +6
-53
lines changed 5 files changed +6
-53
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ public protocol RegexBenchmark {
8
8
9
9
public struct Benchmark : RegexBenchmark {
10
10
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 >
12
12
let ty : MatchType
13
13
let target : String
14
14
@@ -72,22 +72,13 @@ public struct BenchmarkRunner {
72
72
suite. append ( new)
73
73
}
74
74
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
-
85
75
func measure( benchmark: some RegexBenchmark ) -> Time {
86
76
var times : [ Time ] = [ ]
87
77
88
78
// initial run to make sure the regex has been compiled
89
79
benchmark. run ( )
90
80
81
+ // fixme: use suspendingclock?
91
82
for _ in 0 ..< samples {
92
83
let start = Tick . now
93
84
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
12
2
import ArgumentParser
13
3
14
4
public 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
12
2
#if !USE_FOUNDATION_DATE && (os(macOS) || os(iOS) || os(watchOS) || os(tvOS))
13
3
import Foundation // For the side effect of reexporting Darwin/Glibc
14
4
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
11
2
12
3
import Foundation
13
4
import 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
11
2
12
3
public struct Timer {
13
4
internal var _expectNested : Bool ? = nil
You can’t perform that action at this time.
0 commit comments