Skip to content

[Gardening] Remove extra Foundation imports #25853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion benchmark/single-source/AngryPhonebook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// This test is based on single-source/Phonebook, with
// to test uppercase and lowercase ASCII string fast paths.
import TestsUtils
import Foundation

public let AngryPhonebook = BenchmarkInfo(
name: "AngryPhonebook",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// This test checks performance of generic binary floating-point conversion from
// a binary integer.

import Foundation
import TestsUtils

#if swift(>=4.2)
Expand Down Expand Up @@ -110,7 +109,7 @@ extension MockBinaryInteger : BinaryInteger {
var trailingZeroBitCount: Int {
return _value.trailingZeroBitCount
}

func isMultiple(of other: MockBinaryInteger<T>) -> Bool {
return _value.isMultiple(of: other._value)
}
Expand Down Expand Up @@ -211,4 +210,3 @@ public func run_BinaryFloatingPointConversionFromBinaryInteger(_ N: Int) {
}

#endif

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
//
//===----------------------------------------------------------------------===//

import Foundation
import TestsUtils

public let BinaryFloatingPointPropertiesBinade = BenchmarkInfo(
Expand Down
1 change: 0 additions & 1 deletion benchmark/single-source/BitCount.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// This test checks performance of Swift bit count.
// and mask operator.
// rdar://problem/22151678
import Foundation
import TestsUtils

public let BitCount = BenchmarkInfo(
Expand Down
10 changes: 5 additions & 5 deletions benchmark/single-source/BucketSort.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@
// https://github.com/raywenderlich/swift-algorithm-club/tree/master/Bucket%20Sort
//
// It sorts an array of generic `SortableItem`s. If the type of `sortingAlgo`
// is not known to the call site at line 90, the `sort` method can not be
// is not known to the call site at line 89, the `sort` method can not be
// specialized to integer array sorting, which will lead to a huge performance
// loss. Since `SortingAlgorithm` and `InsertionSort` are declared to be
// `public` and the lines 89-91 can not be inlined in `bucketSort` (due to
// `public` and the lines 88-90 can not be inlined in `bucketSort` (due to
// inlining heuristic limitations), compiler without ExistentialSpecializer
// optimization can not achieve this feat. With ExistentialSpecializer which
// enables generic specialization recursively in a call chain, we're able to
// specialize line 90 for `InsertionSort` on integers.
// specialize line 89 for `InsertionSort` on integers.

import TestsUtils
import Foundation

public let BucketSort = BenchmarkInfo(
name: "BucketSort",
Expand Down Expand Up @@ -117,7 +116,8 @@ let items: [Int] = {
let buckets: [Bucket<Int>] = {
let bucketCount = 10
let maxValue = items.max()!.convertToInt()
let maxCapacity = Int(ceil(Double(maxValue + 1) / Double(bucketCount)))
let maxCapacity = Int(
(Double(maxValue + 1) / Double(bucketCount)).rounded(.up))
return (0..<bucketCount).map { _ in Bucket<Int>(capacity: maxCapacity) }
}()

Expand Down
1 change: 0 additions & 1 deletion benchmark/single-source/ByteSwap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// This test checks performance of Swift byte swap.
// rdar://problem/22151907

import Foundation
import TestsUtils

public let ByteSwap = BenchmarkInfo(
Expand Down
2 changes: 2 additions & 0 deletions benchmark/single-source/CString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import TestsUtils
#if os(Linux)
import Glibc
#elseif os(Windows)
import MSVCRT
#else
import Darwin
#endif
Expand Down
2 changes: 0 additions & 2 deletions benchmark/single-source/Calculator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//

import TestsUtils
import Foundation

public let Calculator = BenchmarkInfo(
name: "Calculator",
Expand Down Expand Up @@ -53,4 +52,3 @@ public func run_Calculator(_ N: Int) {
}
CheckResults(c == 0)
}

1 change: 0 additions & 1 deletion benchmark/single-source/Hanoi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

// This test checks performance of Swift hanoi tower.
// <rdar://problem/22151932>
import Foundation
import TestsUtils

public let Hanoi = BenchmarkInfo(
Expand Down
3 changes: 0 additions & 3 deletions benchmark/single-source/OpenClose.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
//===----------------------------------------------------------------------===//

import TestsUtils
import Foundation


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

1 change: 0 additions & 1 deletion benchmark/single-source/ProtocolDispatch2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


import TestsUtils
import Foundation

public let ProtocolDispatch2 = BenchmarkInfo(
name: "ProtocolDispatch2",
Expand Down
1 change: 0 additions & 1 deletion benchmark/single-source/RGBHistogram.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
//
// Description:
// Create a sorted sparse RGB histogram from an array of 300 RGB values.
import Foundation
import TestsUtils

public let RGBHistogram = [
Expand Down
8 changes: 7 additions & 1 deletion benchmark/single-source/Radix2CooleyTukey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
//
// Originally written by @owensd. Used with his permission.

import Foundation
#if os(Linux)
import Glibc
#elseif os(Windows)
import MSVCRT
#else
import Darwin
#endif
import TestsUtils

public var Radix2CooleyTukey = [
Expand Down
1 change: 0 additions & 1 deletion benchmark/single-source/ReduceInto.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//

import TestsUtils
import Foundation

public let ReduceInto = [
BenchmarkInfo(name: "FilterEvenUsingReduce", runFunction: run_FilterEvenUsingReduce, tags: [.validation, .api], legacyFactor: 10),
Expand Down
1 change: 0 additions & 1 deletion benchmark/single-source/SortLettersInPlace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

// This test checks performance and correctness of Swift sortInPlace on an
// array of letters.
import Foundation
import TestsUtils

public let SortLettersInPlace = BenchmarkInfo(
Expand Down
2 changes: 2 additions & 0 deletions benchmark/single-source/StringEdits.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import TestsUtils
#if os(Linux)
import Glibc
#elseif os(Windows)
import MSVCRT
#else
import Darwin
#endif
Expand Down
2 changes: 2 additions & 0 deletions benchmark/single-source/StringMatch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import TestsUtils
#if os(Linux)
import Glibc
#elseif os(Windows)
import MSVCRT
#else
import Darwin
#endif
Expand Down
3 changes: 2 additions & 1 deletion benchmark/single-source/Walsh.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import TestsUtils
#if os(Linux)
import Glibc
#elseif os(Windows)
import MSVCRT
#else
import Darwin
#endif
Expand Down Expand Up @@ -89,4 +91,3 @@ public func run_Walsh(_ N: Int) {
InverseWalshTransform(&data2)
}
}

8 changes: 7 additions & 1 deletion benchmark/utils/ArgParse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
//
//===----------------------------------------------------------------------===//

import Foundation
#if os(Linux)
import Glibc
#elseif os(Windows)
import MSVCRT
#else
import Darwin
#endif

enum ArgumentError: Error {
case missingValue(String)
Expand Down
2 changes: 2 additions & 0 deletions benchmark/utils/DriverUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#if os(Linux)
import Glibc
#elseif os(Windows)
import MSVCRT
#else
import Darwin
import LibProc
Expand Down
2 changes: 2 additions & 0 deletions benchmark/utils/TestsUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#if os(Linux)
import Glibc
#elseif os(Windows)
import MSVCRT
#else
import Darwin
#endif
Expand Down