Skip to content

Commit 7c95141

Browse files
committed
[Gardening] Remove extra Foundation imports
Remove the import of Foundation where it is not necessary for testing the ObjC interop.
1 parent b5ae6a4 commit 7c95141

15 files changed

+16
-24
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/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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
//
33
// Originally written by @owensd. Used with his permission.
44

5-
import Foundation
5+
#if os(Linux)
6+
import Glibc
7+
#else
8+
import Darwin
9+
#endif
610
import TestsUtils
711

812
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/utils/ArgParse.swift

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

13-
import Foundation
13+
#if os(Linux)
14+
import Glibc
15+
#else
16+
import Darwin
17+
#endif
1418

1519
enum ArgumentError: Error {
1620
case missingValue(String)

0 commit comments

Comments
 (0)