Skip to content

Commit a9eee38

Browse files
authored
Merge pull request #25853 from palimondo/groundless
[Gardening] Remove extra Foundation imports
2 parents 7076671 + 5190db0 commit a9eee38

21 files changed

+32
-25
lines changed

benchmark/single-source/AngryPhonebook.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// This test is based on single-source/Phonebook, with
1414
// to test uppercase and lowercase ASCII string fast paths.
1515
import TestsUtils
16-
import Foundation
1716

1817
public let AngryPhonebook = BenchmarkInfo(
1918
name: "AngryPhonebook",

benchmark/single-source/BinaryFloatingPointConversionFromBinaryInteger.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// This test checks performance of generic binary floating-point conversion from
1414
// a binary integer.
1515

16-
import Foundation
1716
import TestsUtils
1817

1918
#if swift(>=4.2)
@@ -110,7 +109,7 @@ extension MockBinaryInteger : BinaryInteger {
110109
var trailingZeroBitCount: Int {
111110
return _value.trailingZeroBitCount
112111
}
113-
112+
114113
func isMultiple(of other: MockBinaryInteger<T>) -> Bool {
115114
return _value.isMultiple(of: other._value)
116115
}
@@ -211,4 +210,3 @@ public func run_BinaryFloatingPointConversionFromBinaryInteger(_ N: Int) {
211210
}
212211

213212
#endif
214-

benchmark/single-source/BinaryFloatingPointProperties.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
import Foundation
1413
import TestsUtils
1514

1615
public let BinaryFloatingPointPropertiesBinade = BenchmarkInfo(

benchmark/single-source/BitCount.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// This test checks performance of Swift bit count.
1414
// and mask operator.
1515
// rdar://problem/22151678
16-
import Foundation
1716
import TestsUtils
1817

1918
public let BitCount = BenchmarkInfo(

benchmark/single-source/BucketSort.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,16 @@
1616
// https://github.com/raywenderlich/swift-algorithm-club/tree/master/Bucket%20Sort
1717
//
1818
// It sorts an array of generic `SortableItem`s. If the type of `sortingAlgo`
19-
// is not known to the call site at line 90, the `sort` method can not be
19+
// is not known to the call site at line 89, the `sort` method can not be
2020
// specialized to integer array sorting, which will lead to a huge performance
2121
// loss. Since `SortingAlgorithm` and `InsertionSort` are declared to be
22-
// `public` and the lines 89-91 can not be inlined in `bucketSort` (due to
22+
// `public` and the lines 88-90 can not be inlined in `bucketSort` (due to
2323
// inlining heuristic limitations), compiler without ExistentialSpecializer
2424
// optimization can not achieve this feat. With ExistentialSpecializer which
2525
// enables generic specialization recursively in a call chain, we're able to
26-
// specialize line 90 for `InsertionSort` on integers.
26+
// specialize line 89 for `InsertionSort` on integers.
2727

2828
import TestsUtils
29-
import Foundation
3029

3130
public let BucketSort = BenchmarkInfo(
3231
name: "BucketSort",
@@ -117,7 +116,8 @@ let items: [Int] = {
117116
let buckets: [Bucket<Int>] = {
118117
let bucketCount = 10
119118
let maxValue = items.max()!.convertToInt()
120-
let maxCapacity = Int(ceil(Double(maxValue + 1) / Double(bucketCount)))
119+
let maxCapacity = Int(
120+
(Double(maxValue + 1) / Double(bucketCount)).rounded(.up))
121121
return (0..<bucketCount).map { _ in Bucket<Int>(capacity: maxCapacity) }
122122
}()
123123

benchmark/single-source/ByteSwap.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// This test checks performance of Swift byte swap.
1414
// rdar://problem/22151907
1515

16-
import Foundation
1716
import TestsUtils
1817

1918
public let ByteSwap = BenchmarkInfo(

benchmark/single-source/CString.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import TestsUtils
1414
#if os(Linux)
1515
import Glibc
16+
#elseif os(Windows)
17+
import MSVCRT
1618
#else
1719
import Darwin
1820
#endif

benchmark/single-source/Calculator.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import TestsUtils
14-
import Foundation
1514

1615
public let Calculator = BenchmarkInfo(
1716
name: "Calculator",
@@ -53,4 +52,3 @@ public func run_Calculator(_ N: Int) {
5352
}
5453
CheckResults(c == 0)
5554
}
56-

benchmark/single-source/Hanoi.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
// This test checks performance of Swift hanoi tower.
1414
// <rdar://problem/22151932>
15-
import Foundation
1615
import TestsUtils
1716

1817
public let Hanoi = BenchmarkInfo(

benchmark/single-source/OpenClose.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import TestsUtils
14-
import Foundation
15-
1614

1715
// A micro benchmark for checking the speed of string-based enums.
1816
public let OpenClose = BenchmarkInfo(
@@ -38,4 +36,3 @@ public func run_OpenClose(_ N: Int) {
3836
}
3937
CheckResults(c == 0)
4038
}
41-

benchmark/single-source/ProtocolDispatch2.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616

1717
import TestsUtils
18-
import Foundation
1918

2019
public let ProtocolDispatch2 = BenchmarkInfo(
2120
name: "ProtocolDispatch2",

benchmark/single-source/RGBHistogram.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
//
1616
// Description:
1717
// Create a sorted sparse RGB histogram from an array of 300 RGB values.
18-
import Foundation
1918
import TestsUtils
2019

2120
public let RGBHistogram = [

benchmark/single-source/Radix2CooleyTukey.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
//
33
// Originally written by @owensd. Used with his permission.
44

5-
import Foundation
5+
#if os(Linux)
6+
import Glibc
7+
#elseif os(Windows)
8+
import MSVCRT
9+
#else
10+
import Darwin
11+
#endif
612
import TestsUtils
713

814
public var Radix2CooleyTukey = [

benchmark/single-source/ReduceInto.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import TestsUtils
14-
import Foundation
1514

1615
public let ReduceInto = [
1716
BenchmarkInfo(name: "FilterEvenUsingReduce", runFunction: run_FilterEvenUsingReduce, tags: [.validation, .api], legacyFactor: 10),

benchmark/single-source/SortLettersInPlace.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
// This test checks performance and correctness of Swift sortInPlace on an
1414
// array of letters.
15-
import Foundation
1615
import TestsUtils
1716

1817
public let SortLettersInPlace = BenchmarkInfo(

benchmark/single-source/StringEdits.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import TestsUtils
1414
#if os(Linux)
1515
import Glibc
16+
#elseif os(Windows)
17+
import MSVCRT
1618
#else
1719
import Darwin
1820
#endif

benchmark/single-source/StringMatch.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import TestsUtils
1414
#if os(Linux)
1515
import Glibc
16+
#elseif os(Windows)
17+
import MSVCRT
1618
#else
1719
import Darwin
1820
#endif

benchmark/single-source/Walsh.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import TestsUtils
1414
#if os(Linux)
1515
import Glibc
16+
#elseif os(Windows)
17+
import MSVCRT
1618
#else
1719
import Darwin
1820
#endif
@@ -89,4 +91,3 @@ public func run_Walsh(_ N: Int) {
8991
InverseWalshTransform(&data2)
9092
}
9193
}
92-

benchmark/utils/ArgParse.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
import Foundation
13+
#if os(Linux)
14+
import Glibc
15+
#elseif os(Windows)
16+
import MSVCRT
17+
#else
18+
import Darwin
19+
#endif
1420

1521
enum ArgumentError: Error {
1622
case missingValue(String)

benchmark/utils/DriverUtils.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#if os(Linux)
1414
import Glibc
15+
#elseif os(Windows)
16+
import MSVCRT
1517
#else
1618
import Darwin
1719
import LibProc

benchmark/utils/TestsUtils.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#if os(Linux)
1414
import Glibc
15+
#elseif os(Windows)
16+
import MSVCRT
1517
#else
1618
import Darwin
1719
#endif

0 commit comments

Comments
 (0)