[benchmark] Simplify benchmark registration

This commit is contained in:
Karoy Lorentey
2021-09-15 20:59:39 -07:00
parent 8910b75cfe
commit 8944591e71
184 changed files with 1110 additions and 953 deletions

View File

@@ -59,7 +59,7 @@ set(SWIFT_BENCH_MODULES
single-source/CharacterProperties
single-source/Chars
single-source/ClassArrayGetter
single-source/Codable
single-source/CodableTest
single-source/Combos
single-source/DataBenchmarks
single-source/DeadArray
@@ -76,7 +76,7 @@ set(SWIFT_BENCH_MODULES
single-source/DictionaryCopy
single-source/DictionaryGroup
single-source/DictionaryKeysContains
single-source/DictionaryLiteral
single-source/DictionaryLiteralTest
single-source/DictionaryOfAnyHashableStrings
single-source/DictionaryRemove
single-source/DictionarySubscriptDefault
@@ -112,11 +112,11 @@ set(SWIFT_BENCH_MODULES
single-source/LuhnAlgoLazy
single-source/MapReduce
single-source/Memset
single-source/Mirror
single-source/MirrorTest
single-source/MonteCarloE
single-source/MonteCarloPi
single-source/NSDictionaryCastToSwift
single-source/NSError
single-source/NSErrorTest
single-source/NSStringConversion
single-source/NibbleSort
single-source/NIOChannelPipeline
@@ -143,7 +143,7 @@ set(SWIFT_BENCH_MODULES
single-source/ProtocolConformance
single-source/ProtocolDispatch
single-source/ProtocolDispatch2
single-source/Queue
single-source/QueueTest
single-source/RC4
single-source/RGBHistogram
single-source/Radix2CooleyTukey
@@ -186,7 +186,7 @@ set(SWIFT_BENCH_MODULES
single-source/StringSwitch
single-source/StringTests
single-source/StringWalk
single-source/Substring
single-source/SubstringTest
single-source/Suffix
single-source/SuperChars
single-source/TwoSum

View File

@@ -290,10 +290,12 @@ If needed you can multiply N by a fixed amount (e.g. `1...100*N`) to achieve thi
// rdar://problem/00000000
import TestsUtils
public let YourTestName = BenchmarkInfo(
name: "YourTestName",
runFunction: run_YourTestName,
tags: [.regression])
public let benchmarks = [
BenchmarkInfo(
name: "YourTestName",
runFunction: run_YourTestName,
tags: [.regression])
]
@inline(never)
public func run_YourTestName(n: Int) {

View File

@@ -16,10 +16,12 @@
import TestsUtils
import CxxCreateObjects
public let CreateObjects = BenchmarkInfo(
name: "CreateObjects",
runFunction: run_CreateObjects,
tags: [.validation, .bridging])
public let benchmarks = [
BenchmarkInfo(
name: "CreateObjects",
runFunction: run_CreateObjects,
tags: [.validation, .bridging])
]
@inline(never)
public func run_CreateObjects(_ n: Int) {

View File

@@ -12,11 +12,13 @@
import TestsUtils
public let PrimsSplit = BenchmarkInfo(
name: "PrimsSplit",
runFunction: run_PrimsSplit,
tags: [.validation, .algorithm],
legacyFactor: 5)
public let benchmarks = [
BenchmarkInfo(
name: "PrimsSplit",
runFunction: run_PrimsSplit,
tags: [.validation, .algorithm],
legacyFactor: 5)
]
@inline(never)
public func run_PrimsSplit(_ n: Int) {

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -14,10 +14,12 @@
// for performance measuring.
import TestsUtils
public let Ackermann = BenchmarkInfo(
name: "Ackermann",
runFunction: run_Ackermann,
tags: [.algorithm])
public let benchmarks = [
BenchmarkInfo(
name: "Ackermann",
runFunction: run_Ackermann,
tags: [.algorithm]),
]
func _ackermann(_ m: Int, _ n : Int) -> Int {
if (m == 0) { return n + 1 }

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -16,7 +16,7 @@ import TestsUtils
let t: [BenchmarkCategory] = [.validation, .api, .String]
public let AngryPhonebook = [
public let benchmarks = [
BenchmarkInfo(
name: "AngryPhonebook",
runFunction: run_AngryPhonebook,

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -22,12 +22,14 @@ import TestsUtils
// 11% _swift_stdlib_makeAnyHashableUpcastingToHashableBaseType
// 16% _swift_retain_[n]
// 5% swift_conformsToProtocol
public let AnyHashableWithAClass = BenchmarkInfo(
name: "AnyHashableWithAClass",
runFunction: run_AnyHashableWithAClass,
tags: [.abstraction, .runtime, .cpubench],
legacyFactor: 500
)
public let benchmarks = [
BenchmarkInfo(
name: "AnyHashableWithAClass",
runFunction: run_AnyHashableWithAClass,
tags: [.abstraction, .runtime, .cpubench],
legacyFactor: 500
),
]
class TestHashableBase : Hashable {
var value: Int

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,13 +12,15 @@
import TestsUtils
public let Array2D = BenchmarkInfo(
name: "Array2D",
runFunction: run_Array2D,
tags: [.validation, .api, .Array],
setUpFunction: { blackHole(inputArray) },
tearDownFunction: { inputArray = nil },
legacyFactor: 16)
public let benchmarks = [
BenchmarkInfo(
name: "Array2D",
runFunction: run_Array2D,
tags: [.validation, .api, .Array],
setUpFunction: { blackHole(inputArray) },
tearDownFunction: { inputArray = nil },
legacyFactor: 16),
]
let size = 256

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -15,7 +15,7 @@
import TestsUtils
let t: [BenchmarkCategory] = [.validation, .api, .Array]
public let ArrayAppend = [
public let benchmarks = [
BenchmarkInfo(name: "ArrayAppend", runFunction: run_ArrayAppend, tags: t, legacyFactor: 10),
BenchmarkInfo(name: "ArrayAppendArrayOfInt", runFunction: run_ArrayAppendArrayOfInt, tags: t,
setUpFunction: ones, tearDownFunction: releaseOnes, legacyFactor: 10),

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//
import TestsUtils
public let ArrayInClass = [
public let benchmarks = [
BenchmarkInfo(
name: "ArrayInClass",
runFunction: run_ArrayInClass,

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -15,7 +15,7 @@
// It is reported to be slow: <rdar://problem/17297449>
import TestsUtils
public let ArrayLiteral = [
public let benchmarks = [
BenchmarkInfo(name: "ArrayLiteral2", runFunction: run_ArrayLiteral, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayValueProp", runFunction: run_ArrayValueProp, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayValueProp2", runFunction: run_ArrayValueProp2, tags: [.validation, .api, .Array]),

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -20,7 +20,7 @@
import TestsUtils
public let ArrayOfGenericPOD = [
public let benchmarks = [
BenchmarkInfo(
// Renamed benchmark to "2" when IUO test was removed, which
// effectively changed what we're benchmarking here.

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -17,11 +17,13 @@
import TestsUtils
public let ArrayOfGenericRef = BenchmarkInfo(
name: "ArrayOfGenericRef",
runFunction: run_ArrayOfGenericRef,
tags: [.validation, .api, .Array],
legacyFactor: 10)
public let benchmarks = [
BenchmarkInfo(
name: "ArrayOfGenericRef",
runFunction: run_ArrayOfGenericRef,
tags: [.validation, .api, .Array],
legacyFactor: 10)
]
protocol Constructible {
associatedtype Element

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -18,10 +18,12 @@
import TestsUtils
public let ArrayOfPOD = BenchmarkInfo(
name: "ArrayOfPOD",
runFunction: run_ArrayOfPOD,
tags: [.validation, .api, .Array])
public let benchmarks = [
BenchmarkInfo(
name: "ArrayOfPOD",
runFunction: run_ArrayOfPOD,
tags: [.validation, .api, .Array])
]
class RefArray<T> {
var array : [T]

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -18,11 +18,13 @@
import TestsUtils
public let ArrayOfRef = BenchmarkInfo(
name: "ArrayOfRef",
runFunction: run_ArrayOfRef,
tags: [.validation, .api, .Array],
legacyFactor: 10)
public let benchmarks = [
BenchmarkInfo(
name: "ArrayOfRef",
runFunction: run_ArrayOfRef,
tags: [.validation, .api, .Array],
legacyFactor: 10)
]
protocol Constructible {
associatedtype Element

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -15,11 +15,13 @@ import TestsUtils
// 33% isUniquelyReferenced
// 15% swift_rt_swift_isUniquelyReferencedOrPinned_nonNull_native
// 18% swift_isUniquelyReferencedOrPinned_nonNull_native
public let ArraySetElement = BenchmarkInfo(
name: "ArraySetElement",
runFunction: run_ArraySetElement,
tags: [.runtime, .cpubench]
)
public let benchmarks = [
BenchmarkInfo(
name: "ArraySetElement",
runFunction: run_ArraySetElement,
tags: [.runtime, .cpubench]
),
]
// This is an effort to defeat isUniquelyReferenced optimization. Ideally
// microbenchmarks list this should be written in C.

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -13,11 +13,13 @@
// This test checks the performance of modifying an array element.
import TestsUtils
public let ArraySubscript = BenchmarkInfo(
name: "ArraySubscript",
runFunction: run_ArraySubscript,
tags: [.validation, .api, .Array],
legacyFactor: 4)
public let benchmarks = [
BenchmarkInfo(
name: "ArraySubscript",
runFunction: run_ArraySubscript,
tags: [.validation, .api, .Array],
legacyFactor: 4),
]
@inline(never)
public func run_ArraySubscript(_ n: Int) {
@@ -32,7 +34,7 @@ public func run_ArraySubscript(_ n: Int) {
var arrays = [[Int]](repeating: [], count: numArrays)
for i in 0..<numArrays {
for _ in 0..<numArrayElements {
arrays[i].append(Int(truncatingIfNeeded: lfsr.randInt()))
arrays[i].append(Int(truncatingIfNeeded: lfsr.next()))
}
}

View File

@@ -16,13 +16,15 @@
import TestsUtils
#if swift(>=4.2)
public let BinaryFloatingPointConversionFromBinaryInteger = BenchmarkInfo(
name: "BinaryFloatingPointConversionFromBinaryInteger",
runFunction: run_BinaryFloatingPointConversionFromBinaryInteger,
tags: [.validation, .algorithm]
)
public let benchmarks = [
BenchmarkInfo(
name: "BinaryFloatingPointConversionFromBinaryInteger",
runFunction: run_BinaryFloatingPointConversionFromBinaryInteger,
tags: [.validation, .algorithm]
),
]
#else
public let BinaryFloatingPointConversionFromBinaryInteger: [BenchmarkInfo] = []
public let benchmarks: [BenchmarkInfo] = []
#endif
struct MockBinaryInteger<T : BinaryInteger> {

View File

@@ -12,23 +12,23 @@
import TestsUtils
public let BinaryFloatingPointPropertiesBinade = BenchmarkInfo(
name: "BinaryFloatingPointPropertiesBinade",
runFunction: run_BinaryFloatingPointPropertiesBinade,
tags: [.validation, .algorithm]
)
public let BinaryFloatingPointPropertiesNextUp = BenchmarkInfo(
name: "BinaryFloatingPointPropertiesNextUp",
runFunction: run_BinaryFloatingPointPropertiesNextUp,
tags: [.validation, .algorithm]
)
public let BinaryFloatingPointPropertiesUlp = BenchmarkInfo(
name: "BinaryFloatingPointPropertiesUlp",
runFunction: run_BinaryFloatingPointPropertiesUlp,
tags: [.validation, .algorithm]
)
public let benchmarks = [
BenchmarkInfo(
name: "BinaryFloatingPointPropertiesBinade",
runFunction: run_BinaryFloatingPointPropertiesBinade,
tags: [.validation, .algorithm]
),
BenchmarkInfo(
name: "BinaryFloatingPointPropertiesNextUp",
runFunction: run_BinaryFloatingPointPropertiesNextUp,
tags: [.validation, .algorithm]
),
BenchmarkInfo(
name: "BinaryFloatingPointPropertiesUlp",
runFunction: run_BinaryFloatingPointPropertiesUlp,
tags: [.validation, .algorithm]
)
]
@inline(never)
public func run_BinaryFloatingPointPropertiesBinade(_ n: Int) {

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -15,10 +15,12 @@
// rdar://problem/22151678
import TestsUtils
public let BitCount = BenchmarkInfo(
name: "BitCount",
runFunction: run_BitCount,
tags: [.validation, .algorithm])
public let benchmarks = [
BenchmarkInfo(
name: "BitCount",
runFunction: run_BitCount,
tags: [.validation, .algorithm]),
]
func countBitSet(_ num: Int) -> Int {
let bits = MemoryLayout<Int>.size * 8

View File

@@ -16,7 +16,7 @@ import TestsUtils
// breadcrumbs. These are used to speed up range- and positional access through
// conventional NSString APIs.
public let Breadcrumbs: [BenchmarkInfo] = [
public let benchmarks: [BenchmarkInfo] = [
UTF16ToIdx(workload: longASCIIWorkload, count: 5_000).info,
UTF16ToIdx(workload: longMixedWorkload, count: 5_000).info,
IdxToUTF16(workload: longASCIIWorkload, count: 5_000).info,

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -27,12 +27,14 @@
import TestsUtils
public let BucketSort = BenchmarkInfo(
name: "BucketSort",
runFunction: run_BucketSort,
tags: [.validation, .algorithm],
setUpFunction: { blackHole(buckets) }
)
public let benchmarks = [
BenchmarkInfo(
name: "BucketSort",
runFunction: run_BucketSort,
tags: [.validation, .algorithm],
setUpFunction: { blackHole(buckets) }
),
]
public protocol IntegerConvertible {
func convertToInt() -> Int

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2020 Apple Inc. and the Swift project authors
// Copyright (c) 2020 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,7 +12,7 @@
import TestsUtils
public let BufferFill = [
public let benchmarks = [
BenchmarkInfo(name: "BufferFillFromSlice",
runFunction: bufferFillFromSliceExecute,
tags: [.validation, .api],

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -15,10 +15,12 @@
import TestsUtils
public let ByteSwap = BenchmarkInfo(
name: "ByteSwap",
runFunction: run_ByteSwap,
tags: [.validation, .algorithm])
public let benchmarks = [
BenchmarkInfo(
name: "ByteSwap",
runFunction: run_ByteSwap,
tags: [.validation, .algorithm]),
]
// a naive O(n) implementation of byteswap.
@inline(never)

View File

@@ -15,12 +15,14 @@ import TestsUtils
// This test makes sure that even though we have +0 arguments by default that we
// can properly convert +0 -> +1 to avoid extra COW copies.
public let COWArrayGuaranteedParameterOverhead = BenchmarkInfo(
name: "COWArrayGuaranteedParameterOverhead",
runFunction: run_COWArrayGuaranteedParameterOverhead,
tags: [.regression, .abstraction, .refcount],
legacyFactor: 50
)
public let benchmarks = [
BenchmarkInfo(
name: "COWArrayGuaranteedParameterOverhead",
runFunction: run_COWArrayGuaranteedParameterOverhead,
tags: [.regression, .abstraction, .refcount],
legacyFactor: 50
),
]
@inline(never)
func caller() {

View File

@@ -5,12 +5,14 @@
import TestsUtils
public var COWTree = BenchmarkInfo(
name: "COWTree",
runFunction: run_COWTree,
tags: [.validation, .abstraction, .String],
legacyFactor: 20
)
public let benchmarks = [
BenchmarkInfo(
name: "COWTree",
runFunction: run_COWTree,
tags: [.validation, .abstraction, .String],
legacyFactor: 20
),
]
@inline(never)
public func run_COWTree(_ n: Int) {

View File

@@ -1,5 +1,5 @@
import TestsUtils
public let CSVParsing = [
public let benchmarks = [
BenchmarkInfo(
name: "CSVParsing.Char",
runFunction: run_CSVParsing_characters,

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -19,7 +19,7 @@ import MSVCRT
import Darwin
#endif
public let CString = [
public let benchmarks = [
BenchmarkInfo(name: "CStringLongAscii", runFunction: run_CStringLongAscii, tags: [.validation, .api, .String, .bridging]),
BenchmarkInfo(name: "CStringLongNonAscii", runFunction: run_CStringLongNonAscii, tags: [.validation, .api, .String, .bridging]),
BenchmarkInfo(name: "CStringShortAscii", runFunction: run_CStringShortAscii, tags: [.validation, .api, .String, .bridging], legacyFactor: 10),

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,10 +12,12 @@
import TestsUtils
public let Calculator = BenchmarkInfo(
name: "Calculator",
runFunction: run_Calculator,
tags: [.validation])
public let benchmarks = [
BenchmarkInfo(
name: "Calculator",
runFunction: run_Calculator,
tags: [.validation])
]
@inline(never)
func my_atoi_impl(_ input : String) -> Int {

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,11 +12,13 @@
import TestsUtils
public let CaptureProp = BenchmarkInfo(
name: "CaptureProp",
runFunction: run_CaptureProp,
tags: [.validation, .api, .refcount],
legacyFactor: 10)
public let benchmarks = [
BenchmarkInfo(
name: "CaptureProp",
runFunction: run_CaptureProp,
tags: [.validation, .api, .refcount],
legacyFactor: 10),
]
func sum(_ x:Int, y:Int) -> Int {
return x + y

View File

@@ -343,10 +343,12 @@ extension UInt32 {
}
public let ChaCha = BenchmarkInfo(
name: "ChaCha",
runFunction: run_ChaCha,
tags: [.runtime, .cpubench])
public let benchmarks = [
BenchmarkInfo(
name: "ChaCha",
runFunction: run_ChaCha,
tags: [.runtime, .cpubench]),
]
@inline(never)
func checkResult(_ plaintext: [UInt8]) {

View File

@@ -1,6 +1,6 @@
import TestsUtils
public let ChainedFilterMap = [
public let benchmarks = [
BenchmarkInfo(name: "ChainedFilterMap", runFunction: run_ChainedFilterMap,
tags: [.algorithm], setUpFunction: { blackHole(first100k) },
legacyFactor: 9),

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -15,10 +15,12 @@
// and retain a StringBuffer.
import TestsUtils
public let CharacterLiteralsLarge = BenchmarkInfo(
name: "CharacterLiteralsLarge",
runFunction: run_CharacterLiteralsLarge,
tags: [.validation, .api, .String])
public let benchmarks = [
BenchmarkInfo(
name: "CharacterLiteralsLarge",
runFunction: run_CharacterLiteralsLarge,
tags: [.validation, .api, .String])
]
@inline(never)
func makeCharacter_UTF8Length9() -> Character {

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -15,10 +15,12 @@
// represented as a packed integer.
import TestsUtils
public let CharacterLiteralsSmall = BenchmarkInfo(
name: "CharacterLiteralsSmall",
runFunction: run_CharacterLiteralsSmall,
tags: [.validation, .api, .String])
public let benchmarks = [
BenchmarkInfo(
name: "CharacterLiteralsSmall",
runFunction: run_CharacterLiteralsSmall,
tags: [.validation, .api, .String]),
]
@inline(never)
func makeCharacter_UTF8Length1() -> Character {

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -19,33 +19,35 @@
import TestsUtils
import Foundation
public let CharacterPropertiesFetch = BenchmarkInfo(
name: "CharacterPropertiesFetch",
runFunction: run_CharacterPropertiesFetch,
tags: [.validation, .api, .String],
setUpFunction: { blackHole(workload) },
legacyFactor: 10)
public let benchmarks = [
BenchmarkInfo(
name: "CharacterPropertiesFetch",
runFunction: run_CharacterPropertiesFetch,
tags: [.validation, .api, .String],
setUpFunction: { blackHole(workload) },
legacyFactor: 10),
public let CharacterPropertiesStashed = BenchmarkInfo(
name: "CharacterPropertiesStashed",
runFunction: run_CharacterPropertiesStashed,
tags: [.validation, .api, .String],
setUpFunction: { setupStash() },
legacyFactor: 10)
BenchmarkInfo(
name: "CharacterPropertiesStashed",
runFunction: run_CharacterPropertiesStashed,
tags: [.validation, .api, .String],
setUpFunction: { setupStash() },
legacyFactor: 10),
public let CharacterPropertiesStashedMemo = BenchmarkInfo(
name: "CharacterPropertiesStashedMemo",
runFunction: run_CharacterPropertiesStashedMemo,
tags: [.validation, .api, .String],
setUpFunction: { setupMemo() },
legacyFactor: 10)
BenchmarkInfo(
name: "CharacterPropertiesStashedMemo",
runFunction: run_CharacterPropertiesStashedMemo,
tags: [.validation, .api, .String],
setUpFunction: { setupMemo() },
legacyFactor: 10),
public let CharacterPropertiesPrecomputed = BenchmarkInfo(
name: "CharacterPropertiesPrecomputed",
runFunction: run_CharacterPropertiesPrecomputed,
tags: [.validation, .api, .String],
setUpFunction: { setupPrecomputed() },
legacyFactor: 10)
BenchmarkInfo(
name: "CharacterPropertiesPrecomputed",
runFunction: run_CharacterPropertiesPrecomputed,
tags: [.validation, .api, .String],
setUpFunction: { setupPrecomputed() },
legacyFactor: 10),
]
extension Character {
var firstScalar: UnicodeScalar { return unicodeScalars.first! }

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -20,33 +20,35 @@
import TestsUtils
import Foundation
public let CharacterPropertiesFetch = BenchmarkInfo(
name: "CharacterPropertiesFetch",
runFunction: run_CharacterPropertiesFetch,
tags: [.validation, .api, .String],
setUpFunction: { blackHole(workload) },
legacyFactor: 10)
public let benchmarks = [
BenchmarkInfo(
name: "CharacterPropertiesFetch",
runFunction: run_CharacterPropertiesFetch,
tags: [.validation, .api, .String],
setUpFunction: { blackHole(workload) },
legacyFactor: 10),
public let CharacterPropertiesStashed = BenchmarkInfo(
name: "CharacterPropertiesStashed",
runFunction: run_CharacterPropertiesStashed,
tags: [.validation, .api, .String],
setUpFunction: { setupStash() },
legacyFactor: 10)
BenchmarkInfo(
name: "CharacterPropertiesStashed",
runFunction: run_CharacterPropertiesStashed,
tags: [.validation, .api, .String],
setUpFunction: { setupStash() },
legacyFactor: 10),
public let CharacterPropertiesStashedMemo = BenchmarkInfo(
name: "CharacterPropertiesStashedMemo",
runFunction: run_CharacterPropertiesStashedMemo,
tags: [.validation, .api, .String],
setUpFunction: { setupMemo() },
legacyFactor: 10)
BenchmarkInfo(
name: "CharacterPropertiesStashedMemo",
runFunction: run_CharacterPropertiesStashedMemo,
tags: [.validation, .api, .String],
setUpFunction: { setupMemo() },
legacyFactor: 10),
public let CharacterPropertiesPrecomputed = BenchmarkInfo(
name: "CharacterPropertiesPrecomputed",
runFunction: run_CharacterPropertiesPrecomputed,
tags: [.validation, .api, .String],
setUpFunction: { setupPrecomputed() },
legacyFactor: 10)
BenchmarkInfo(
name: "CharacterPropertiesPrecomputed",
runFunction: run_CharacterPropertiesPrecomputed,
tags: [.validation, .api, .String],
setUpFunction: { setupPrecomputed() },
legacyFactor: 10),
]
extension Character {
var firstScalar: UnicodeScalar { return unicodeScalars.first! }

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -13,12 +13,14 @@
// This test tests the performance of ASCII Character comparison.
import TestsUtils
public let Chars = BenchmarkInfo(
name: "Chars2",
runFunction: run_Chars,
tags: [.validation, .api, .String],
setUpFunction: { blackHole(alphabetInput) },
legacyFactor: 50)
public let benchmarks = [
BenchmarkInfo(
name: "Chars2",
runFunction: run_Chars,
tags: [.validation, .api, .String],
setUpFunction: { blackHole(alphabetInput) },
legacyFactor: 50),
]
let alphabetInput: [Character] = [
"A", "B", "C", "D", "E", "F", "G",

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,13 +12,15 @@
import TestsUtils
public let ClassArrayGetter = BenchmarkInfo(
name: "ClassArrayGetter2",
runFunction: run_ClassArrayGetter,
tags: [.validation, .api, .Array],
setUpFunction: { blackHole(inputArray) },
tearDownFunction: { inputArray = nil },
legacyFactor: 10)
public let benchmarks = [
BenchmarkInfo(
name: "ClassArrayGetter2",
runFunction: run_ClassArrayGetter,
tags: [.validation, .api, .Array],
setUpFunction: { blackHole(inputArray) },
tearDownFunction: { inputArray = nil },
legacyFactor: 10),
]
class Box {
var v: Int

View File

@@ -1,4 +1,4 @@
//===--- JSON.swift -------------------------------------------------------===//
//===--- CodableTest.swift ------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
@@ -14,14 +14,14 @@ import TestsUtils
import Foundation
#if _runtime(_ObjC)
public let Codable = [
public let benchmarks = [
BenchmarkInfo(name: "JSONPerfEncode", runFunction: run_JSONPerfEncode, tags: [.validation, .bridging], setUpFunction: setup_json),
BenchmarkInfo(name: "JSONPerfDecode", runFunction: run_JSONPerfDecode, tags: [.validation, .bridging], setUpFunction: setup_json),
BenchmarkInfo(name: "PlistPerfEncode", runFunction: run_PlistPerfEncode, tags: [.validation, .bridging], setUpFunction: setup_plist),
BenchmarkInfo(name: "PlistPerfDecode", runFunction: run_PlistPerfDecode, tags: [.validation, .bridging], setUpFunction: setup_plist),
]
#else
public let Codable = [
public let benchmarks = [
BenchmarkInfo(name: "JSONPerfEncode", runFunction: run_JSONPerfEncode, tags: [.validation, .bridging], setUpFunction: setup_json),
BenchmarkInfo(name: "JSONPerfDecode", runFunction: run_JSONPerfDecode, tags: [.validation, .bridging], setUpFunction: setup_json),
]

View File

@@ -5,11 +5,13 @@
import TestsUtils
public var Combos = BenchmarkInfo(
name: "Combos",
runFunction: run_Combos,
tags: [.validation, .abstraction]
)
public let benchmarks = [
BenchmarkInfo(
name: "Combos",
runFunction: run_Combos,
tags: [.validation, .abstraction]
),
]
@inline(never)
public func run_Combos(_ n: Int) {

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -15,7 +15,7 @@ import Foundation
let d: [BenchmarkCategory] = [.validation, .api, .Data, .cpubench]
public let DataBenchmarks = [
public let benchmarks = [
BenchmarkInfo(name: "DataCreateEmpty",
runFunction: { for _ in 0..<$0*10_000 { blackHole(Data()) } },
tags: d, legacyFactor: 10),

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -13,12 +13,14 @@
// rdar://problem/20980377
import TestsUtils
public let DeadArray = BenchmarkInfo(
name: "DeadArray",
runFunction: run_DeadArray,
tags: [.regression, .unstable],
legacyFactor: 200
)
public let benchmarks = [
BenchmarkInfo(
name: "DeadArray",
runFunction: run_DeadArray,
tags: [.regression, .unstable],
legacyFactor: 200
),
]
@inline(__always)
func debug(_ m:String) {}

View File

@@ -12,7 +12,7 @@
import TestsUtils
public let DevirtualizeProtocolComposition = [
public let benchmarks = [
BenchmarkInfo(name: "DevirtualizeProtocolComposition", runFunction: run_DevirtualizeProtocolComposition, tags: [.validation, .api]),
]

View File

@@ -6,11 +6,13 @@
import TestsUtils
public var DictOfArraysToArrayOfDicts = BenchmarkInfo(
name: "DictOfArraysToArrayOfDicts",
runFunction: run_DictOfArraysToArrayOfDicts,
tags: [.algorithm, .Dictionary]
)
public let benchmarks = [
BenchmarkInfo(
name: "DictOfArraysToArrayOfDicts",
runFunction: run_DictOfArraysToArrayOfDicts,
tags: [.algorithm, .Dictionary]
),
]
@inline(never)
public func run_DictOfArraysToArrayOfDicts(_ n: Int) {

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -13,7 +13,7 @@
import TestsUtils
public let Dictionary = [
public let benchmarks = [
BenchmarkInfo(name: "Dictionary", runFunction: run_Dictionary,
tags: [.validation, .api, .Dictionary],
setUpFunction: { blackHole(half) },

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,7 +12,7 @@
import TestsUtils
public let Dictionary2 = [
public let benchmarks = [
BenchmarkInfo(name: "Dictionary2",
runFunction: run_Dictionary2,
tags: [.validation, .api, .Dictionary],

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,7 +12,7 @@
import TestsUtils
public let Dictionary3 = [
public let benchmarks = [
BenchmarkInfo(name: "Dictionary3", runFunction: run_Dictionary3, tags: [.validation, .api, .Dictionary]),
BenchmarkInfo(name: "Dictionary3OfObjects", runFunction: run_Dictionary3OfObjects, tags: [.validation, .api, .Dictionary]),
]

View File

@@ -15,7 +15,7 @@ import TestsUtils
// This benchmark mostly measures lookups in dictionaries with complex keys,
// exercising the default hash compression function.
public let Dictionary4 = [
public let benchmarks = [
BenchmarkInfo(
name: "Dictionary4",
runFunction: run_Dictionary4,

View File

@@ -15,7 +15,7 @@ import TestsUtils
// This benchmark mostly measures lookups in dictionaries with complex keys,
// using the legacy hashValue API.
public let Dictionary4Legacy = [
public let benchmarks = [
BenchmarkInfo(
name: "Dictionary4Legacy",
runFunction: run_Dictionary4Legacy,

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -16,10 +16,12 @@
import Foundation
import TestsUtils
public let DictionaryBridge = BenchmarkInfo(
name: "DictionaryBridge",
runFunction: run_DictionaryBridge,
tags: [.validation, .api, .Dictionary, .bridging])
public let benchmarks = [
BenchmarkInfo(
name: "DictionaryBridge",
runFunction: run_DictionaryBridge,
tags: [.validation, .api, .Dictionary, .bridging]),
]
#if _runtime(_ObjC)
class Thing : NSObject {

View File

@@ -16,7 +16,7 @@ import TestsUtils
#if _runtime(_ObjC)
import Foundation
public let DictionaryBridgeToObjC = [
public let benchmarks = [
BenchmarkInfo(
name: "DictionaryBridgeToObjC_Bridge",
runFunction: run_DictionaryBridgeToObjC_BridgeToObjC,
@@ -82,5 +82,5 @@ public func run_DictionaryBridgeToObjC_BulkAccess(_ n: Int) {
}
#else // !_runtime(ObjC)
public let DictionaryBridgeToObjC: [BenchmarkInfo] = []
public let benchmarks: [BenchmarkInfo] = []
#endif

View File

@@ -23,7 +23,7 @@ let oddStringMap: [Int: String] = Dictionary(uniqueKeysWithValues:
let t: [BenchmarkCategory] = [.validation, .api, .Dictionary]
public let DictionaryCompactMapValues = [
public let benchmarks = [
BenchmarkInfo(name: "DictionaryCompactMapValuesOfNilValue",
runFunction: compactMapValues, tags: t,
setUpFunction: { blackHole(smallOddNumMap); blackHole(compactOddNums)},

View File

@@ -22,7 +22,7 @@ let t: [BenchmarkCategory] = [.validation, .api, .Dictionary]
// We run the test at a spread of sizes between 1*x and 2*x, because the
// quadratic behavior only happens at certain load factors.
public let DictionaryCopy = [
public let benchmarks = [
BenchmarkInfo(name:"Dict.CopyKeyValue.16k",
runFunction: copyKeyValue, tags: t, setUpFunction: { dict(16_000) }),
BenchmarkInfo(name:"Dict.CopyKeyValue.20k",

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,7 +12,7 @@
import TestsUtils
public let DictionaryGroup = [
public let benchmarks = [
BenchmarkInfo(name: "DictionaryGroup",
runFunction: run_DictionaryGroup,
tags: [.validation, .api, .Dictionary]),

View File

@@ -16,7 +16,7 @@ import TestsUtils
import Foundation
#if _runtime(_ObjC)
public let DictionaryKeysContains = [
public let benchmarks = [
BenchmarkInfo(
name: "DictionaryKeysContainsNative",
runFunction: run_DictionaryKeysContains,
@@ -32,7 +32,7 @@ public let DictionaryKeysContains = [
tearDownFunction: teardownDictionary),
]
#else
public let DictionaryKeysContains = [
public let benchmarks = [
BenchmarkInfo(
name: "DictionaryKeysContainsNative",
runFunction: run_DictionaryKeysContains,

View File

@@ -1,8 +1,8 @@
//===--- DictionaryLiteral.swift ------------------------------------------===//
//===--- DictionaryLiteralTest.swift --------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -14,11 +14,13 @@
// rdar://problem/19804127
import TestsUtils
public let DictionaryLiteral = BenchmarkInfo(
name: "DictionaryLiteral",
runFunction: run_DictionaryLiteral,
tags: [.validation, .api, .Dictionary],
legacyFactor: 10)
public let benchmarks = [
BenchmarkInfo(
name: "DictionaryLiteral",
runFunction: run_DictionaryLiteral,
tags: [.validation, .api, .Dictionary],
legacyFactor: 10),
]
@inline(never)
func makeDictionary() -> [Int: Int] {

View File

@@ -16,7 +16,7 @@ import TestsUtils
// small ASCII String keys. Untyped NSDictionary values get imported as this
// type, so it occurs relatively often in practice.
public var DictionaryOfAnyHashableStrings = [
public let benchmarks = [
BenchmarkInfo(
name: "DictionaryOfAnyHashableStrings_insert",
runFunction: run_DictionaryOfAnyHashableStrings_insert,

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -21,7 +21,7 @@ let numberMap = Dictionary(uniqueKeysWithValues: zip(1...size, 1...size))
let boxedNums = (1...size).lazy.map { Box($0) }
let boxedNumMap = Dictionary(uniqueKeysWithValues: zip(boxedNums, boxedNums))
public let DictionaryRemove = [
public let benchmarks = [
BenchmarkInfo(name: "DictionaryRemove",
runFunction: remove, tags: t, legacyFactor: 10),
BenchmarkInfo(name: "DictionaryRemoveOfObjects",

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,7 +12,7 @@
import TestsUtils
public let DictionarySubscriptDefault = [
public let benchmarks = [
BenchmarkInfo(name: "DictionarySubscriptDefaultMutation",
runFunction: run_DictionarySubscriptDefaultMutation,
tags: [.validation, .api, .Dictionary]),

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -21,7 +21,7 @@ let boxedNumMap = Dictionary(uniqueKeysWithValues: zip(boxedNums, boxedNums))
let t: [BenchmarkCategory] = [.validation, .api, .Dictionary, .cpubench]
public let DictionarySwap = [
public let benchmarks = [
BenchmarkInfo(name: "DictionarySwap",
runFunction: swap, tags: t, legacyFactor: 4),
BenchmarkInfo(name: "DictionarySwapOfObjects",

View File

@@ -15,7 +15,7 @@
import TestsUtils
import _Differentiation
public let Differentiation = [
public let benchmarks = [
BenchmarkInfo(
name: "DifferentiationIdentity",
runFunction: run_DifferentiationIdentity,

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -13,7 +13,7 @@
import TestsUtils
let t: [BenchmarkCategory] = [.api]
public let Diffing = [
public let benchmarks = [
BenchmarkInfo(
name: "Diffing.Same",
runFunction: { diff($0, from: longPangram, to: longPangram) },

View File

@@ -16,11 +16,13 @@ import TestsUtils
// described in Myers (1986). The Diffing benchmark tracks the performance
// of `Collection.difference(from:to:)`.
public let DiffingMyers = BenchmarkInfo(
name: "Diffing.Myers.Similar",
runFunction: run_Myers,
tags: [.algorithm],
setUpFunction: { blackHole((loremIpsum, unabridgedLorem)) })
public let benchmarks = [
BenchmarkInfo(
name: "Diffing.Myers.Similar",
runFunction: run_Myers,
tags: [.algorithm],
setUpFunction: { blackHole((loremIpsum, unabridgedLorem)) })
]
let loremIpsum = Array("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -24,7 +24,7 @@ let suffixCount = sequenceCount - dropCount
let sumCount = suffixCount * (2 * sequenceCount - suffixCount - 1) / 2
let array: [Int] = Array(0..<sequenceCount)
public let DropFirst = [
public let benchmarks = [
BenchmarkInfo(
name: "DropFirstCountableRange",
runFunction: run_DropFirstCountableRange,

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -43,7 +43,7 @@ def lazy (NameExpr) : return (NameExpr[0] + 'Lazy', '(' + NameExpr[1] + ').lazy'
Sequences = Sequences + list(map(lazy, Sequences))
}%
public let DropFirst = [
public let benchmarks = [
% for (Name, Expr) in Sequences:
BenchmarkInfo(
name: "DropFirst${Name}",

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -24,7 +24,7 @@ let dropCount = sequenceCount - prefixCount
let sumCount = prefixCount * (prefixCount - 1) / 2
let array: [Int] = Array(0..<sequenceCount)
public let DropLast = [
public let benchmarks = [
BenchmarkInfo(
name: "DropLastCountableRange",
runFunction: run_DropLastCountableRange,

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -43,7 +43,7 @@ def lazy (NameExpr) : return (NameExpr[0] + 'Lazy', '(' + NameExpr[1] + ').lazy'
Sequences = Sequences + list(map(lazy, Sequences))
}%
public let DropLast = [
public let benchmarks = [
% for (Name, Expr) in Sequences:
BenchmarkInfo(
name: "DropLast${Name}",

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -24,7 +24,7 @@ let suffixCount = sequenceCount - dropCount
let sumCount = suffixCount * (2 * sequenceCount - suffixCount - 1) / 2
let array: [Int] = Array(0..<sequenceCount)
public let DropWhile = [
public let benchmarks = [
BenchmarkInfo(
name: "DropWhileCountableRange",
runFunction: run_DropWhileCountableRange,

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -43,7 +43,7 @@ def lazy (NameExpr) : return (NameExpr[0] + 'Lazy', '(' + NameExpr[1] + ').lazy'
Sequences = Sequences + list(map(lazy, Sequences))
}%
public let DropWhile = [
public let benchmarks = [
% for (Name, Expr) in Sequences:
BenchmarkInfo(
name: "DropWhile${Name}",

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,11 +12,13 @@
import TestsUtils
public let ErrorHandling = BenchmarkInfo(
name: "ErrorHandling",
runFunction: run_ErrorHandling,
tags: [.validation, .exceptions],
legacyFactor: 10)
public let benchmarks = [
BenchmarkInfo(
name: "ErrorHandling",
runFunction: run_ErrorHandling,
tags: [.validation, .exceptions],
legacyFactor: 10),
]
enum PizzaError : Error {
case Pepperoni, Olives, Anchovy

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -17,7 +17,7 @@
import TestsUtils
public let Exclusivity = [
public let benchmarks = [
// At -Onone
// 25% swift_beginAccess
// 15% tlv_get_addr

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -30,7 +30,7 @@ import TestsUtils
let t: [BenchmarkCategory] = [.skip]
let ta: [BenchmarkCategory] = [.api, .Array, .skip]
public let ExistentialPerformance: [BenchmarkInfo] = [
public let benchmarks: [BenchmarkInfo] = [
BenchmarkInfo(name: "Existential.method.1x.Ref1",
runFunction: run_method1x, tags: t, setUpFunction: etRef1),
BenchmarkInfo(name: "Existential.method.1x.Ref2",

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -133,7 +133,7 @@ def run_function_name(benchmark_name):
r'_\1', control_flow_separator_re.sub( # remove dashes
'', benchmark_name)))
}%
public let ExistentialPerformance: [BenchmarkInfo] = [
public let benchmarks: [BenchmarkInfo] = [
% for (Name, Group, Variant) in Names:
BenchmarkInfo(name: "Existential.${Name}",
runFunction: ${run_function_name(Group)

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,10 +12,12 @@
import TestsUtils
public let Fibonacci = BenchmarkInfo(
name: "Fibonacci",
runFunction: run_Fibonacci,
tags: [.algorithm])
public let benchmarks = [
BenchmarkInfo(
name: "Fibonacci",
runFunction: run_Fibonacci,
tags: [.algorithm])
]
func _fibonacci(_ n: Int) -> Int {
if (n <= 2) { return 1 }

View File

@@ -19,7 +19,7 @@ let t: [BenchmarkCategory] = [.String, .refcount]
var longStringFoFoFoFox: String?
var longArrayFoFoFoFox: [UInt8]?
public let FindStringNaive = [
public let benchmarks = [
BenchmarkInfo(
name: "FindString.Loop1.Substring",
runFunction: runBenchLoop1Substring,

View File

@@ -12,17 +12,19 @@
import TestsUtils
public let FlattenListLoop = BenchmarkInfo(
name: "FlattenListLoop",
runFunction: run_FlattenListLoop,
tags: [.api, .validation],
setUpFunction: { blackHole(inputArray) })
public let benchmarks = [
BenchmarkInfo(
name: "FlattenListLoop",
runFunction: run_FlattenListLoop,
tags: [.api, .validation],
setUpFunction: { blackHole(inputArray) }),
public let FlattenListFlatMap = BenchmarkInfo(
name: "FlattenListFlatMap",
runFunction: run_FlattenListFlatMap,
tags: [.api, .validation],
setUpFunction: { blackHole(inputArray) })
BenchmarkInfo(
name: "FlattenListFlatMap",
runFunction: run_FlattenListFlatMap,
tags: [.api, .validation],
setUpFunction: { blackHole(inputArray) }),
]
let inputArray: [(Int, Int, Int, Int)] = (0..<(1<<16)).map { _ in
(5, 6, 7, 8)

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2020 Apple Inc. and the Swift project authors
// Copyright (c) 2020 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,7 +12,7 @@
import TestsUtils
public let FloatingPointConversion = [
public let benchmarks = [
BenchmarkInfo(
name: "ConvertFloatingPoint.MockFloat64ToDouble",
runFunction: run_ConvertFloatingPoint_MockFloat64ToDouble,

View File

@@ -15,7 +15,7 @@
import TestsUtils
public let FloatingPointParsing = [
public let benchmarks = [
BenchmarkInfo(
name: "ParseFloat.Float.Exp",
runFunction: run_ParseFloatExp,

View File

@@ -15,7 +15,7 @@
import TestsUtils
public let FloatingPointPrinting = [
public let benchmarks = [
BenchmarkInfo(
name: "FloatingPointPrinting_Float_description_small",
runFunction: run_FloatingPointPrinting_Float_description_small,

View File

@@ -18,7 +18,7 @@ import TestsUtils
// Swift's performance switching over enums with substantial amounts of associated data.
//
public let HTTP2StateMachine = [
public let benchmarks = [
BenchmarkInfo(
name: "HTTP2StateMachine",
runFunction: run_HTTP2StateMachine,

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -14,11 +14,13 @@
// <rdar://problem/22151932>
import TestsUtils
public let Hanoi = BenchmarkInfo(
name: "Hanoi",
runFunction: run_Hanoi,
tags: [.validation, .algorithm],
legacyFactor: 10)
public let benchmarks = [
BenchmarkInfo(
name: "Hanoi",
runFunction: run_Hanoi,
tags: [.validation, .algorithm],
legacyFactor: 10),
]
struct Move {
var from: String

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -15,11 +15,13 @@
// http://en.wikipedia.org/wiki/SHA-1
import TestsUtils
public let HashTest = BenchmarkInfo(
name: "HashTest",
runFunction: run_HashTest,
tags: [.validation, .algorithm],
legacyFactor: 10)
public let benchmarks = [
BenchmarkInfo(
name: "HashTest",
runFunction: run_HashTest,
tags: [.validation, .algorithm],
legacyFactor: 10),
]
class Hash {
/// C'tor.

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -14,10 +14,12 @@
// <rdar://problem/17384894>
import TestsUtils
public let Histogram = BenchmarkInfo(
name: "Histogram",
runFunction: run_Histogram,
tags: [.validation, .algorithm])
public let benchmarks = [
BenchmarkInfo(
name: "Histogram",
runFunction: run_Histogram,
tags: [.validation, .algorithm]),
]
typealias rrggbb_t = UInt32

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2020 Apple Inc. and the Swift project authors
// Copyright (c) 2020 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -20,7 +20,7 @@ let increasingMaxMiddleIndexPath = indexPath(size, middle: size + 1)
let increasingMinMiddleIndexPath = indexPath(size, middle: -1)
let tags: [BenchmarkCategory] = [.validation, .api, .IndexPath]
public let IndexPathTest = [
public let benchmarks = [
BenchmarkInfo(
name: "IndexPath.Subscript.Mutation",
runFunction: run_IndexPathSubscriptMutation,

View File

@@ -14,7 +14,7 @@ import TestsUtils
let t: [BenchmarkCategory] = [.validation, .api, .String]
public let InsertCharacter = [
public let benchmarks = [
BenchmarkInfo(name: "InsertCharacterEndIndex",
runFunction: run_InsertCharacterEndIndex, tags: t,
setUpFunction: buildWorkload),

View File

@@ -14,7 +14,7 @@ import TestsUtils
// - Definitions
public let IntegerParsing = [
public let benchmarks = [
// IntSmall
BenchmarkInfo(name: "ParseInt.IntSmall.Decimal",
runFunction: run_ParseIntFromIntSmallDecimal,

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -15,10 +15,12 @@ import TestsUtils
// A micro-benchmark for recursive divide and conquer problems.
// The program performs integration via Gaussian Quadrature
public let IntegrateTest = BenchmarkInfo(
name: "Integrate",
runFunction: run_Integrate,
tags: [.validation, .algorithm])
public let benchmarks = [
BenchmarkInfo(
name: "Integrate",
runFunction: run_Integrate,
tags: [.validation, .algorithm]),
]
class Integrate {
static let epsilon = 1.0e-9

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -13,11 +13,13 @@
import TestsUtils
import Foundation
public let IterateData = BenchmarkInfo(
name: "IterateData",
runFunction: run_IterateData,
tags: [.validation, .api, .Data],
setUpFunction: { blackHole(data) })
public let benchmarks = [
BenchmarkInfo(
name: "IterateData",
runFunction: run_IterateData,
tags: [.validation, .api, .Data],
setUpFunction: { blackHole(data) }),
]
let data: Data = {
var data = Data(count: 16 * 1024)

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -13,10 +13,12 @@
// This test tests the performance of ASCII Character comparison.
import TestsUtils
public let Join = BenchmarkInfo(
name: "Join",
runFunction: run_Join,
tags: [.validation, .api, .String, .Array])
public let benchmarks = [
BenchmarkInfo(
name: "Join",
runFunction: run_Join,
tags: [.validation, .api, .String, .Array])
]
@inline(never)
public func run_Join(_ n: Int) {

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -14,7 +14,7 @@
// collections.
import TestsUtils
public let LazyFilter = [
public let benchmarks = [
BenchmarkInfo(name: "LazilyFilteredArrays2",
runFunction: run_LazilyFilteredArrays,
tags: [.validation, .api, .Array],

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -16,13 +16,15 @@ import TestsUtils
// 47% _swift_retain
// 43% _swift_release
public var LinkedList = BenchmarkInfo(
name: "LinkedList",
runFunction: run_LinkedList,
tags: [.runtime, .cpubench, .refcount],
setUpFunction: { for i in 0..<size { head = Node(n:head, d:i) } },
tearDownFunction: { head = Node(n:nil, d:0) },
legacyFactor: 40)
public let benchmarks = [
BenchmarkInfo(
name: "LinkedList",
runFunction: run_LinkedList,
tags: [.runtime, .cpubench, .refcount],
setUpFunction: { for i in 0..<size { head = Node(n:head, d:i) } },
tearDownFunction: { head = Node(n:nil, d:0) },
legacyFactor: 40),
]
let size = 100
var head = Node(n:nil, d:0)

View File

@@ -5,11 +5,13 @@
import TestsUtils
public let LuhnAlgoEager = BenchmarkInfo(
name: "LuhnAlgoEager",
runFunction: run_LuhnAlgoEager,
tags: [.algorithm]
)
public let benchmarks = [
BenchmarkInfo(
name: "LuhnAlgoEager",
runFunction: run_LuhnAlgoEager,
tags: [.algorithm]
),
]
@inline(never)
public func run_LuhnAlgoEager(_ n: Int) {

View File

@@ -5,11 +5,13 @@
import TestsUtils
public let LuhnAlgoLazy = BenchmarkInfo(
name: "LuhnAlgoLazy",
runFunction: run_LuhnAlgoLazy,
tags: [.algorithm]
)
public let benchmarks = [
BenchmarkInfo(
name: "LuhnAlgoLazy",
runFunction: run_LuhnAlgoLazy,
tags: [.algorithm]
),
]
@inline(never)
public func run_LuhnAlgoLazy(_ n: Int) {

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -16,7 +16,7 @@ import Foundation
let t: [BenchmarkCategory] = [.validation, .algorithm]
let ts: [BenchmarkCategory] = [.validation, .algorithm, .String]
public let MapReduce = [
public let benchmarks = [
BenchmarkInfo(name: "MapReduce", runFunction: run_MapReduce, tags: t),
BenchmarkInfo(name: "MapReduceAnyCollection",
runFunction: run_MapReduceAnyCollection, tags: t),

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,10 +12,12 @@
import TestsUtils
public let Memset = BenchmarkInfo(
name: "Memset",
runFunction: run_Memset,
tags: [.validation])
public let benchmarks = [
BenchmarkInfo(
name: "Memset",
runFunction: run_Memset,
tags: [.validation]),
]
@inline(never)
func memset(_ a: inout [Int], _ c: Int) {

View File

@@ -1,8 +1,8 @@
//===--- Mirror.swift ------------------------------------------------===//
//===--- MirrorTest.swift -------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -13,15 +13,16 @@
// This test measures performance of Mirror and related things.
import TestsUtils
public let TypeName = BenchmarkInfo(
name: "TypeName",
runFunction: run_TypeName,
tags: [.api, .String])
public let MirrorDefault = BenchmarkInfo(
name: "MirrorDefault",
runFunction: run_MirrorDefault,
tags: [.api, .String])
public let benchmarks = [
BenchmarkInfo(
name: "TypeName",
runFunction: run_TypeName,
tags: [.api, .String]),
BenchmarkInfo(
name: "MirrorDefault",
runFunction: run_MirrorDefault,
tags: [.api, .String]),
]
struct S1 { var s: String; var d: Double }
struct S2 { var i: Int; var a: [Range<Int>] }

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -19,11 +19,13 @@
// Thus, e = N / Nempty.
import TestsUtils
public let MonteCarloE = BenchmarkInfo(
name: "MonteCarloE",
runFunction: run_MonteCarloE,
tags: [.validation, .algorithm],
legacyFactor: 20)
public let benchmarks = [
BenchmarkInfo(
name: "MonteCarloE",
runFunction: run_MonteCarloE,
tags: [.validation, .algorithm],
legacyFactor: 20),
]
public func run_MonteCarloE(scale: Int) {
var lfsr = LFSR()

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -12,11 +12,13 @@
import TestsUtils
public let MonteCarloPi = BenchmarkInfo(
name: "MonteCarloPi",
runFunction: run_MonteCarloPi,
tags: [.validation, .algorithm],
legacyFactor: 125)
public let benchmarks = [
BenchmarkInfo(
name: "MonteCarloPi",
runFunction: run_MonteCarloPi,
tags: [.validation, .algorithm],
legacyFactor: 125)
]
public func run_MonteCarloPi(scale: Int) {
var rng = LFSR()

View File

@@ -17,7 +17,7 @@ import TestsUtils
let t: [BenchmarkCategory] = [.runtime, .refcount, .cpubench]
let n = 100
public let NIOChannelPipeline = [
public let benchmarks = [
BenchmarkInfo(
name: "NIOChannelPipeline",
runFunction: runBench,

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -18,11 +18,13 @@
import Foundation
import TestsUtils
public let NSDictionaryCastToSwift = BenchmarkInfo(
name: "NSDictionaryCastToSwift",
runFunction: run_NSDictionaryCastToSwift,
tags: [.validation, .api, .Dictionary, .bridging],
legacyFactor: 10)
public let benchmarks = [
BenchmarkInfo(
name: "NSDictionaryCastToSwift",
runFunction: run_NSDictionaryCastToSwift,
tags: [.validation, .api, .Dictionary, .bridging],
legacyFactor: 10),
]
@inline(never)
public func run_NSDictionaryCastToSwift(_ n: Int) {

Some files were not shown because too many files have changed in this diff Show More