Move all benchmarks to use registerBenchmark and BenchmarkInfo

This commit is contained in:
Max Moiseev
2017-10-03 17:46:11 -07:00
parent 86eeb5416b
commit 1dd9d61ded
107 changed files with 1663 additions and 553 deletions

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let PrimsSplit = BenchmarkInfo(
name: "PrimsSplit",
runFunction: run_PrimsSplit,
tags: [.validation, .algorithm])
@inline(never) @inline(never)
public func run_PrimsSplit(_ N: Int) { public func run_PrimsSplit(_ N: Int) {
for _ in 1...5*N { for _ in 1...5*N {

View File

@@ -14,6 +14,11 @@
// for performance measuring. // for performance measuring.
import TestsUtils import TestsUtils
public let Ackermann = BenchmarkInfo(
name: "Ackermann",
runFunction: run_Ackermann,
tags: [.unstable, .algorithm])
func ackermann(_ M: Int, _ N : Int) -> Int { func ackermann(_ M: Int, _ N : Int) -> Int {
if (M == 0) { return N + 1 } if (M == 0) { return N + 1 }
if (N == 0) { return ackermann(M - 1, 1) } if (N == 0) { return ackermann(M - 1, 1) }

View File

@@ -15,6 +15,11 @@
import TestsUtils import TestsUtils
import Foundation import Foundation
public let AngryPhonebook = BenchmarkInfo(
name: "AngryPhonebook",
runFunction: run_AngryPhonebook,
tags: [.validation, .api, .String])
var words = [ var words = [
"James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph", "James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph",
"Charles", "Thomas", "Christopher", "Daniel", "Matthew", "Donald", "Anthony", "Charles", "Thomas", "Christopher", "Daniel", "Matthew", "Donald", "Anthony",

View File

@@ -10,6 +10,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils
public let Array2D = BenchmarkInfo(
name: "Array2D",
runFunction: run_Array2D,
tags: [.validation, .api, .Array])
@inline(never) @inline(never)
public func run_Array2D(_ N: Int) { public func run_Array2D(_ N: Int) {
var A: [[Int]] = [] var A: [[Int]] = []

View File

@@ -14,6 +14,28 @@
import TestsUtils import TestsUtils
public let ArrayAppend = [
BenchmarkInfo(name: "ArrayAppend", runFunction: run_ArrayAppend, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendArrayOfInt", runFunction: run_ArrayAppendArrayOfInt, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendAscii", runFunction: run_ArrayAppendAscii, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendFromGeneric", runFunction: run_ArrayAppendFromGeneric, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendGenericStructs", runFunction: run_ArrayAppendGenericStructs, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendLatin1", runFunction: run_ArrayAppendLatin1, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendLazyMap", runFunction: run_ArrayAppendLazyMap, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendOptionals", runFunction: run_ArrayAppendOptionals, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendRepeatCol", runFunction: run_ArrayAppendRepeatCol, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendReserved", runFunction: run_ArrayAppendReserved, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendSequence", runFunction: run_ArrayAppendSequence, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendStrings", runFunction: run_ArrayAppendStrings, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendToFromGeneric", runFunction: run_ArrayAppendToFromGeneric, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendToGeneric", runFunction: run_ArrayAppendToGeneric, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayAppendUTF16", runFunction: run_ArrayAppendUTF16, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayPlusEqualArrayOfInt", runFunction: run_ArrayPlusEqualArrayOfInt, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayPlusEqualFiveElementCollection", runFunction: run_ArrayPlusEqualFiveElementCollection, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayPlusEqualSingleElementCollection", runFunction: run_ArrayPlusEqualSingleElementCollection, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayPlusEqualThreeElements", runFunction: run_ArrayPlusEqualThreeElements, tags: [.validation, .api, .Array]),
]
// Append single element // Append single element
@inline(never) @inline(never)
public func run_ArrayAppend(_ N: Int) { public func run_ArrayAppend(_ N: Int) {

View File

@@ -10,6 +10,12 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils
public let ArrayInClass = BenchmarkInfo(
name: "ArrayInClass",
runFunction: run_ArrayInClass,
tags: [.validation, .api, .Array])
class ArrayContainer { class ArrayContainer {
final var arr : [Int] final var arr : [Int]

View File

@@ -15,6 +15,14 @@
// It is reported to be slow: <rdar://problem/17297449> // It is reported to be slow: <rdar://problem/17297449>
import TestsUtils import TestsUtils
public let ArrayLiteral = [
BenchmarkInfo(name: "ArrayLiteral", 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]),
BenchmarkInfo(name: "ArrayValueProp3", runFunction: run_ArrayValueProp3, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ArrayValueProp4", runFunction: run_ArrayValueProp4, tags: [.validation, .api, .Array]),
]
@inline(never) @inline(never)
func makeArray() -> [Int] { func makeArray() -> [Int] {
return [1,2,3] return [1,2,3]

View File

@@ -18,6 +18,13 @@
// For comparison, we always create three arrays of 200,000 words. // For comparison, we always create three arrays of 200,000 words.
// An integer enum takes two words. // An integer enum takes two words.
import TestsUtils
public let ArrayOfGenericPOD = BenchmarkInfo(
name: "ArrayOfGenericPOD",
runFunction: run_ArrayOfGenericPOD,
tags: [.validation, .api, .Array])
class RefArray<T> { class RefArray<T> {
var array: [T] var array: [T]

View File

@@ -15,6 +15,13 @@
// //
// For comparison, we always create three arrays of 10,000 words. // For comparison, we always create three arrays of 10,000 words.
import TestsUtils
public let ArrayOfGenericRef = BenchmarkInfo(
name: "ArrayOfGenericRef",
runFunction: run_ArrayOfGenericRef,
tags: [.validation, .api, .Array])
protocol Constructible { protocol Constructible {
associatedtype Element associatedtype Element
init(e:Element) init(e:Element)

View File

@@ -16,6 +16,13 @@
// //
// For comparison, we always create three arrays of 200,000 words. // For comparison, we always create three arrays of 200,000 words.
import TestsUtils
public let ArrayOfPOD = BenchmarkInfo(
name: "ArrayOfPOD",
runFunction: run_ArrayOfPOD,
tags: [.validation, .api, .Array])
class RefArray<T> { class RefArray<T> {
var array : [T] var array : [T]

View File

@@ -16,6 +16,13 @@
// //
// For comparison, we always create four arrays of 10,000 words. // For comparison, we always create four arrays of 10,000 words.
import TestsUtils
public let ArrayOfRef = BenchmarkInfo(
name: "ArrayOfRef",
runFunction: run_ArrayOfRef,
tags: [.validation, .api, .Array])
protocol Constructible { protocol Constructible {
associatedtype Element associatedtype Element
init(e:Element) init(e:Element)

View File

@@ -13,6 +13,11 @@
// This test checks the performance of modifying an array element. // This test checks the performance of modifying an array element.
import TestsUtils import TestsUtils
public let ArraySubscript = BenchmarkInfo(
name: "ArraySubscript",
runFunction: run_ArraySubscript,
tags: [.validation, .api, .Array])
@inline(never) @inline(never)
public func run_ArraySubscript(_ N: Int) { public func run_ArraySubscript(_ N: Int) {
SRand() SRand()

View File

@@ -16,6 +16,11 @@
import Foundation import Foundation
import TestsUtils import TestsUtils
public let BitCount = BenchmarkInfo(
name: "BitCount",
runFunction: run_BitCount,
tags: [.validation, .algorithm])
func countBitSet(_ num: Int) -> Int { func countBitSet(_ num: Int) -> Int {
let bits = MemoryLayout<Int>.size * 8 let bits = MemoryLayout<Int>.size * 8
var cnt: Int = 0 var cnt: Int = 0

View File

@@ -16,6 +16,11 @@
import Foundation import Foundation
import TestsUtils import TestsUtils
public let ByteSwap = BenchmarkInfo(
name: "ByteSwap",
runFunction: run_ByteSwap,
tags: [.validation, .algorithm])
// a naive O(n) implementation of byteswap. // a naive O(n) implementation of byteswap.
@inline(never) @inline(never)
func byteswap_n(_ a: UInt64) -> UInt64 { func byteswap_n(_ a: UInt64) -> UInt64 {

View File

@@ -17,6 +17,13 @@ import Glibc
import Darwin import Darwin
#endif #endif
public let CString = [
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]),
BenchmarkInfo(name: "StringWithCString", runFunction: run_StringWithCString, tags: [.validation, .api, .String, .bridging]),
]
let ascii = "Swift is a multi-paradigm, compiled programming language created for iOS, OS X, watchOS, tvOS and Linux development by Apple Inc. Swift is designed to work with Apple's Cocoa and Cocoa Touch frameworks and the large body of existing Objective-C code written for Apple products. Swift is intended to be more resilient to erroneous code (\"safer\") than Objective-C and also more concise. It is built with the LLVM compiler framework included in Xcode 6 and later and uses the Objective-C runtime, which allows C, Objective-C, C++ and Swift code to run within a single program." let ascii = "Swift is a multi-paradigm, compiled programming language created for iOS, OS X, watchOS, tvOS and Linux development by Apple Inc. Swift is designed to work with Apple's Cocoa and Cocoa Touch frameworks and the large body of existing Objective-C code written for Apple products. Swift is intended to be more resilient to erroneous code (\"safer\") than Objective-C and also more concise. It is built with the LLVM compiler framework included in Xcode 6 and later and uses the Objective-C runtime, which allows C, Objective-C, C++ and Swift code to run within a single program."
let japanese = "日本語(にほんご、にっぽんご)は、主に日本国内や日本人同士の間で使われている言語である。" let japanese = "日本語(にほんご、にっぽんご)は、主に日本国内や日本人同士の間で使われている言語である。"

View File

@@ -13,6 +13,11 @@
import TestsUtils import TestsUtils
import Foundation import Foundation
public let Calculator = BenchmarkInfo(
name: "Calculator",
runFunction: run_Calculator,
tags: [.validation])
@inline(never) @inline(never)
func my_atoi_impl(_ input : String) -> Int { func my_atoi_impl(_ input : String) -> Int {
switch input { switch input {

View File

@@ -10,6 +10,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils
public let CaptureProp = BenchmarkInfo(
name: "CaptureProp",
runFunction: run_CaptureProp,
tags: [.validation, .api, .refcount])
func sum(_ x:Int, y:Int) -> Int { func sum(_ x:Int, y:Int) -> Int {
return x + y return x + y
} }

View File

@@ -15,6 +15,11 @@
// and retain a StringBuffer. // and retain a StringBuffer.
import TestsUtils import TestsUtils
public let CharacterLiteralsLarge = BenchmarkInfo(
name: "CharacterLiteralsLarge",
runFunction: run_CharacterLiteralsLarge,
tags: [.validation, .api, .String])
@inline(never) @inline(never)
func makeCharacter_UTF8Length9() -> Character { func makeCharacter_UTF8Length9() -> Character {
return "a\u{0300}\u{0301}\u{0302}\u{0303}" return "a\u{0300}\u{0301}\u{0302}\u{0303}"

View File

@@ -15,6 +15,11 @@
// represented as a packed integer. // represented as a packed integer.
import TestsUtils import TestsUtils
public let CharacterLiteralsSmall = BenchmarkInfo(
name: "CharacterLiteralsSmall",
runFunction: run_CharacterLiteralsSmall,
tags: [.validation, .api, .String])
@inline(never) @inline(never)
func makeCharacter_UTF8Length1() -> Character { func makeCharacter_UTF8Length1() -> Character {
return "a" return "a"

View File

@@ -13,6 +13,11 @@
// This test tests the performance of ASCII Character comparison. // This test tests the performance of ASCII Character comparison.
import TestsUtils import TestsUtils
public let Chars = BenchmarkInfo(
name: "Chars",
runFunction: run_Chars,
tags: [.validation, .api, .String])
@inline(never) @inline(never)
public func run_Chars(_ N: Int) { public func run_Chars(_ N: Int) {
// Permute some characters. // Permute some characters.

View File

@@ -10,6 +10,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils
public let ClassArrayGetter = BenchmarkInfo(
name: "ClassArrayGetter",
runFunction: run_ClassArrayGetter,
tags: [.validation, .api, .Array])
class Box { class Box {
var v: Int var v: Int
init(v: Int) { self.v = v } init(v: Int) { self.v = v }

View File

@@ -13,6 +13,11 @@
// rdar://problem/20980377 // rdar://problem/20980377
import TestsUtils import TestsUtils
public let DeadArray = BenchmarkInfo(
name: "DeadArray",
runFunction: run_DeadArray,
tags: [.regression])
@inline(__always) @inline(__always)
func debug(_ m:String) {} func debug(_ m:String) {}

View File

@@ -12,6 +12,12 @@
import TestsUtils import TestsUtils
public let Dictionary = [
BenchmarkInfo(name: "Dictionary", runFunction: run_Dictionary, tags: [.validation, .api, .Dictionary]),
BenchmarkInfo(name: "DictionaryOfObjects", runFunction: run_DictionaryOfObjects, tags: [.validation, .api, .Dictionary]),
]
@inline(never) @inline(never)
public func run_Dictionary(scale: Int) { public func run_Dictionary(scale: Int) {
let Input = [ let Input = [

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let Dictionary2 = [
BenchmarkInfo(name: "Dictionary2", runFunction: run_Dictionary2, tags: [.validation, .api, .Dictionary]),
BenchmarkInfo(name: "Dictionary2OfObjects", runFunction: run_Dictionary2OfObjects, tags: [.validation, .api, .Dictionary]),
]
@inline(never) @inline(never)
public func run_Dictionary2(_ N: Int) { public func run_Dictionary2(_ N: Int) {
let size = 500 let size = 500
@@ -55,6 +60,7 @@ class Box<T : Hashable> : Hashable {
@inline(never) @inline(never)
public func run_Dictionary2OfObjects(_ N: Int) { public func run_Dictionary2OfObjects(_ N: Int) {
let size = 500 let size = 500
let ref_result = 199 let ref_result = 199
var res = 0 var res = 0

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let Dictionary3 = [
BenchmarkInfo(name: "Dictionary3", runFunction: run_Dictionary3, tags: [.validation, .api, .Dictionary]),
BenchmarkInfo(name: "Dictionary3OfObjects", runFunction: run_Dictionary3OfObjects, tags: [.validation, .api, .Dictionary]),
]
@inline(never) @inline(never)
public func run_Dictionary3(_ N: Int) { public func run_Dictionary3(_ N: Int) {
let size1 = 100 let size1 = 100

View File

@@ -16,6 +16,11 @@
import Foundation import Foundation
import TestsUtils import TestsUtils
public let DictionaryBridge = BenchmarkInfo(
name: "DictionaryBridge",
runFunction: run_DictionaryBridge,
tags: [.validation, .api, .Dictionary, .bridging])
#if _runtime(_ObjC) #if _runtime(_ObjC)
class Thing : NSObject { class Thing : NSObject {

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let DictionaryGroup = [
BenchmarkInfo(name: "DictionaryGroup", runFunction: run_DictionaryGroup, tags: [.validation, .api, .Dictionary]),
BenchmarkInfo(name: "DictionaryGroupOfObjects", runFunction: run_DictionaryGroupOfObjects, tags: [.validation, .api, .Dictionary]),
]
let count = 10_000 let count = 10_000
let result = count / 10 let result = count / 10

View File

@@ -14,6 +14,11 @@
// rdar://problem/19804127 // rdar://problem/19804127
import TestsUtils import TestsUtils
public let DictionaryLiteral = BenchmarkInfo(
name: "DictionaryLiteral",
runFunction: run_DictionaryLiteral,
tags: [.validation, .api, .Dictionary])
@inline(never) @inline(never)
func makeDictionary() -> [Int: Int] { func makeDictionary() -> [Int: Int] {
return [1: 3, 2: 2, 3: 1] return [1: 3, 2: 2, 3: 1]

View File

@@ -14,6 +14,11 @@
// rdar://problem/19804127 // rdar://problem/19804127
import TestsUtils import TestsUtils
public let DictionaryRemove = [
BenchmarkInfo(name: "DictionaryRemove", runFunction: run_DictionaryRemove, tags: [.validation, .api, .Dictionary]),
BenchmarkInfo(name: "DictionaryRemoveOfObjects", runFunction: run_DictionaryRemoveOfObjects, tags: [.validation, .api, .Dictionary]),
]
@inline(never) @inline(never)
public func run_DictionaryRemove(_ N: Int) { public func run_DictionaryRemove(_ N: Int) {
let size = 100 let size = 100

View File

@@ -14,6 +14,11 @@
// rdar://problem/19804127 // rdar://problem/19804127
import TestsUtils import TestsUtils
public let DictionarySwap = [
BenchmarkInfo(name: "DictionarySwap", runFunction: run_DictionarySwap, tags: [.validation, .api, .Dictionary]),
BenchmarkInfo(name: "DictionarySwapOfObjects", runFunction: run_DictionarySwapOfObjects, tags: [.validation, .api, .Dictionary]),
]
@inline(never) @inline(never)
public func run_DictionarySwap(_ N: Int) { public func run_DictionarySwap(_ N: Int) {
let size = 100 let size = 100

View File

@@ -23,6 +23,66 @@ let dropCount = 1024
let suffixCount = sequenceCount - dropCount let suffixCount = sequenceCount - dropCount
let sumCount = suffixCount * (2 * sequenceCount - suffixCount - 1) / 2 let sumCount = suffixCount * (2 * sequenceCount - suffixCount - 1) / 2
public let DropFirst = [
BenchmarkInfo(
name: "DropFirstCountableRange",
runFunction: run_DropFirstCountableRange,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropFirstSequence",
runFunction: run_DropFirstSequence,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropFirstAnySequence",
runFunction: run_DropFirstAnySequence,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropFirstAnySeqCntRange",
runFunction: run_DropFirstAnySeqCntRange,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropFirstAnySeqCRangeIter",
runFunction: run_DropFirstAnySeqCRangeIter,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropFirstAnyCollection",
runFunction: run_DropFirstAnyCollection,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropFirstArray",
runFunction: run_DropFirstArray,
tags: [.validation, .api, .Array]),
BenchmarkInfo(
name: "DropFirstCountableRangeLazy",
runFunction: run_DropFirstCountableRangeLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropFirstSequenceLazy",
runFunction: run_DropFirstSequenceLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropFirstAnySequenceLazy",
runFunction: run_DropFirstAnySequenceLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropFirstAnySeqCntRangeLazy",
runFunction: run_DropFirstAnySeqCntRangeLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropFirstAnySeqCRangeIterLazy",
runFunction: run_DropFirstAnySeqCRangeIterLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropFirstAnyCollectionLazy",
runFunction: run_DropFirstAnyCollectionLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropFirstArrayLazy",
runFunction: run_DropFirstArrayLazy,
tags: [.validation, .api]),
]
@inline(never) @inline(never)
public func run_DropFirstCountableRange(_ N: Int) { public func run_DropFirstCountableRange(_ N: Int) {
let s = 0..<sequenceCount let s = 0..<sequenceCount

View File

@@ -42,6 +42,16 @@ def lazy ((Name, Expr)) : return (Name + 'Lazy', '(' + Expr + ').lazy')
Sequences = Sequences + map(lazy, Sequences) Sequences = Sequences + map(lazy, Sequences)
}% }%
public let DropFirst = [
% for (Name, Expr) in Sequences:
BenchmarkInfo(
name: "DropFirst${Name}",
runFunction: run_DropFirst${Name},
tags: [.validation, .api${', .Array' if Name == 'Array' else ''}]),
% end
]
% for (Name, Expr) in Sequences: % for (Name, Expr) in Sequences:
@inline(never) @inline(never)
public func run_DropFirst${Name}(_ N: Int) { public func run_DropFirst${Name}(_ N: Int) {

View File

@@ -23,6 +23,65 @@ let prefixCount = 1024
let dropCount = sequenceCount - prefixCount let dropCount = sequenceCount - prefixCount
let sumCount = prefixCount * (prefixCount - 1) / 2 let sumCount = prefixCount * (prefixCount - 1) / 2
public let DropLast = [
BenchmarkInfo(
name: "DropLastCountableRange",
runFunction: run_DropLastCountableRange,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropLastSequence",
runFunction: run_DropLastSequence,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropLastAnySequence",
runFunction: run_DropLastAnySequence,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropLastAnySeqCntRange",
runFunction: run_DropLastAnySeqCntRange,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropLastAnySeqCRangeIter",
runFunction: run_DropLastAnySeqCRangeIter,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropLastAnyCollection",
runFunction: run_DropLastAnyCollection,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropLastArray",
runFunction: run_DropLastArray,
tags: [.validation, .api, .Array]),
BenchmarkInfo(
name: "DropLastCountableRangeLazy",
runFunction: run_DropLastCountableRangeLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropLastSequenceLazy",
runFunction: run_DropLastSequenceLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropLastAnySequenceLazy",
runFunction: run_DropLastAnySequenceLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropLastAnySeqCntRangeLazy",
runFunction: run_DropLastAnySeqCntRangeLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropLastAnySeqCRangeIterLazy",
runFunction: run_DropLastAnySeqCRangeIterLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropLastAnyCollectionLazy",
runFunction: run_DropLastAnyCollectionLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropLastArrayLazy",
runFunction: run_DropLastArrayLazy,
tags: [.validation, .api]),
]
@inline(never) @inline(never)
public func run_DropLastCountableRange(_ N: Int) { public func run_DropLastCountableRange(_ N: Int) {
let s = 0..<sequenceCount let s = 0..<sequenceCount

View File

@@ -42,6 +42,15 @@ def lazy ((Name, Expr)) : return (Name + 'Lazy', '(' + Expr + ').lazy')
Sequences = Sequences + map(lazy, Sequences) Sequences = Sequences + map(lazy, Sequences)
}% }%
public let DropLast = [
% for (Name, Expr) in Sequences:
BenchmarkInfo(
name: "DropLast${Name}",
runFunction: run_DropLast${Name},
tags: [.validation, .api${', .Array' if Name == 'Array' else ''}]),
% end
]
% for (Name, Expr) in Sequences: % for (Name, Expr) in Sequences:
@inline(never) @inline(never)
public func run_DropLast${Name}(_ N: Int) { public func run_DropLast${Name}(_ N: Int) {

View File

@@ -23,6 +23,65 @@ let dropCount = 1024
let suffixCount = sequenceCount - dropCount let suffixCount = sequenceCount - dropCount
let sumCount = suffixCount * (2 * sequenceCount - suffixCount - 1) / 2 let sumCount = suffixCount * (2 * sequenceCount - suffixCount - 1) / 2
public let DropWhile = [
BenchmarkInfo(
name: "DropWhileCountableRange",
runFunction: run_DropWhileCountableRange,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropWhileSequence",
runFunction: run_DropWhileSequence,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropWhileAnySequence",
runFunction: run_DropWhileAnySequence,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropWhileAnySeqCntRange",
runFunction: run_DropWhileAnySeqCntRange,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropWhileAnySeqCRangeIter",
runFunction: run_DropWhileAnySeqCRangeIter,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropWhileAnyCollection",
runFunction: run_DropWhileAnyCollection,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropWhileArray",
runFunction: run_DropWhileArray,
tags: [.validation, .api, .Array]),
BenchmarkInfo(
name: "DropWhileCountableRangeLazy",
runFunction: run_DropWhileCountableRangeLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropWhileSequenceLazy",
runFunction: run_DropWhileSequenceLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropWhileAnySequenceLazy",
runFunction: run_DropWhileAnySequenceLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropWhileAnySeqCntRangeLazy",
runFunction: run_DropWhileAnySeqCntRangeLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropWhileAnySeqCRangeIterLazy",
runFunction: run_DropWhileAnySeqCRangeIterLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropWhileAnyCollectionLazy",
runFunction: run_DropWhileAnyCollectionLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "DropWhileArrayLazy",
runFunction: run_DropWhileArrayLazy,
tags: [.validation, .api]),
]
@inline(never) @inline(never)
public func run_DropWhileCountableRange(_ N: Int) { public func run_DropWhileCountableRange(_ N: Int) {
let s = 0..<sequenceCount let s = 0..<sequenceCount

View File

@@ -42,6 +42,15 @@ def lazy ((Name, Expr)) : return (Name + 'Lazy', '(' + Expr + ').lazy')
Sequences = Sequences + map(lazy, Sequences) Sequences = Sequences + map(lazy, Sequences)
}% }%
public let DropWhile = [
% for (Name, Expr) in Sequences:
BenchmarkInfo(
name: "DropWhile${Name}",
runFunction: run_DropWhile${Name},
tags: [.validation, .api${', .Array' if Name == 'Array' else ''}]),
% end
]
% for (Name, Expr) in Sequences: % for (Name, Expr) in Sequences:
@inline(never) @inline(never)
public func run_DropWhile${Name}(_ N: Int) { public func run_DropWhile${Name}(_ N: Int) {

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let ErrorHandling = BenchmarkInfo(
name: "ErrorHandling",
runFunction: run_ErrorHandling,
tags: [.validation, .exceptions])
enum PizzaError : Error { enum PizzaError : Error {
case Pepperoni, Olives, Anchovy case Pepperoni, Olives, Anchovy
} }

View File

@@ -17,35 +17,37 @@
import TestsUtils import TestsUtils
// At -Onone public let Exclusivity = [
// 25% swift_beginAccess // At -Onone
// 15% tlv_get_addr // 25% swift_beginAccess
// 15% swift_endAccess // 15% tlv_get_addr
public var ExclusivityGlobal = BenchmarkInfo( // 15% swift_endAccess
name: "ExclusivityGlobal", BenchmarkInfo(
runFunction: run_accessGlobal, name: "ExclusivityGlobal",
tags: [.runtime, .cpubench] runFunction: run_accessGlobal,
) tags: [.runtime, .cpubench]
// At -Onone ),
// 23% swift_retain // At -Onone
// 22% swift_release // 23% swift_retain
// 9% swift_beginAccess // 22% swift_release
// 3% swift_endAccess // 9% swift_beginAccess
public var ExclusivityInMatSet = BenchmarkInfo( // 3% swift_endAccess
name: "ExclusivityInMatSet", BenchmarkInfo(
runFunction: run_accessInMatSet, name: "ExclusivityInMatSet",
tags: [.runtime, .cpubench] runFunction: run_accessInMatSet,
) tags: [.runtime, .cpubench]
// At -Onone ),
// 25% swift_release // At -Onone
// 23% swift_retain // 25% swift_release
// 16% swift_beginAccess // 23% swift_retain
// 8% swift_endAccess // 16% swift_beginAccess
public var ExclusivityIndependent = BenchmarkInfo( // 8% swift_endAccess
name: "ExclusivityIndependent", BenchmarkInfo(
runFunction: run_accessIndependent, name: "ExclusivityIndependent",
tags: [.runtime, .cpubench] runFunction: run_accessIndependent,
) tags: [.runtime, .cpubench]
),
]
// Initially these benchmarks only measure access checks at -Onone. In // Initially these benchmarks only measure access checks at -Onone. In
// the future, access checks will also be emitted at -O. // the future, access checks will also be emitted at -O.

View File

@@ -10,6 +10,110 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils
public let ExistentialPerformance = [
BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer1", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer1, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer2", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer2, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer3", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer3, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_ClassValueBuffer4", runFunction: run_ExistentialTestArrayConditionalShift_ClassValueBuffer4, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer0", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer0, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer1", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer1, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer2", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer2, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer3", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer3, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayConditionalShift_IntValueBuffer4", runFunction: run_ExistentialTestArrayConditionalShift_IntValueBuffer4, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer1", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer1, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer2", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer2, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer3", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer3, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayMutating_ClassValueBuffer4", runFunction: run_ExistentialTestArrayMutating_ClassValueBuffer4, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer0", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer0, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer1", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer1, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer2", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer2, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer3", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer3, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayMutating_IntValueBuffer4", runFunction: run_ExistentialTestArrayMutating_IntValueBuffer4, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer1", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer1, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer2", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer2, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer3", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer3, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_ClassValueBuffer4", runFunction: run_ExistentialTestArrayOneMethodCall_ClassValueBuffer4, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer0", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer0, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer1", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer1, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer2", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer2, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer3", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer3, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayOneMethodCall_IntValueBuffer4", runFunction: run_ExistentialTestArrayOneMethodCall_IntValueBuffer4, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer1", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer1, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer2", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer2, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer3", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer3, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayShift_ClassValueBuffer4", runFunction: run_ExistentialTestArrayShift_ClassValueBuffer4, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer0", runFunction: run_ExistentialTestArrayShift_IntValueBuffer0, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer1", runFunction: run_ExistentialTestArrayShift_IntValueBuffer1, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer2", runFunction: run_ExistentialTestArrayShift_IntValueBuffer2, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer3", runFunction: run_ExistentialTestArrayShift_IntValueBuffer3, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayShift_IntValueBuffer4", runFunction: run_ExistentialTestArrayShift_IntValueBuffer4, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer1", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer1, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer2", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer2, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer3", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer3, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_ClassValueBuffer4", runFunction: run_ExistentialTestArrayTwoMethodCalls_ClassValueBuffer4, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer0", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer0, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer1", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer1, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer2", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer2, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer3", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer3, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestArrayTwoMethodCalls_IntValueBuffer4", runFunction: run_ExistentialTestArrayTwoMethodCalls_IntValueBuffer4, tags: [.unstable, .api, .Array]),
BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer1", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer1, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer2", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer2, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer3", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer3, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_ClassValueBuffer4", runFunction: run_ExistentialTestMutatingAndNonMutating_ClassValueBuffer4, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer0", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer0, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer1", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer1, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer2", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer2, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer3", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer3, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutatingAndNonMutating_IntValueBuffer4", runFunction: run_ExistentialTestMutatingAndNonMutating_IntValueBuffer4, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer1", runFunction: run_ExistentialTestMutating_ClassValueBuffer1, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer2", runFunction: run_ExistentialTestMutating_ClassValueBuffer2, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer3", runFunction: run_ExistentialTestMutating_ClassValueBuffer3, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutating_ClassValueBuffer4", runFunction: run_ExistentialTestMutating_ClassValueBuffer4, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer0", runFunction: run_ExistentialTestMutating_IntValueBuffer0, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer1", runFunction: run_ExistentialTestMutating_IntValueBuffer1, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer2", runFunction: run_ExistentialTestMutating_IntValueBuffer2, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer3", runFunction: run_ExistentialTestMutating_IntValueBuffer3, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestMutating_IntValueBuffer4", runFunction: run_ExistentialTestMutating_IntValueBuffer4, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestOneMethodCall_ClassValueBuffer1", runFunction: run_ExistentialTestOneMethodCall_ClassValueBuffer1, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestOneMethodCall_ClassValueBuffer2", runFunction: run_ExistentialTestOneMethodCall_ClassValueBuffer2, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestOneMethodCall_ClassValueBuffer3", runFunction: run_ExistentialTestOneMethodCall_ClassValueBuffer3, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestOneMethodCall_ClassValueBuffer4", runFunction: run_ExistentialTestOneMethodCall_ClassValueBuffer4, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestOneMethodCall_IntValueBuffer0", runFunction: run_ExistentialTestOneMethodCall_IntValueBuffer0, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestOneMethodCall_IntValueBuffer1", runFunction: run_ExistentialTestOneMethodCall_IntValueBuffer1, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestOneMethodCall_IntValueBuffer2", runFunction: run_ExistentialTestOneMethodCall_IntValueBuffer2, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestOneMethodCall_IntValueBuffer3", runFunction: run_ExistentialTestOneMethodCall_IntValueBuffer3, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestOneMethodCall_IntValueBuffer4", runFunction: run_ExistentialTestOneMethodCall_IntValueBuffer4, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer1", runFunction: run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer1, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer2", runFunction: run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer2, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer3", runFunction: run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer3, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer4", runFunction: run_ExistentialTestPassExistentialOneMethodCall_ClassValueBuffer4, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_IntValueBuffer0", runFunction: run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer0, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_IntValueBuffer1", runFunction: run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer1, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_IntValueBuffer2", runFunction: run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer2, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_IntValueBuffer3", runFunction: run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer3, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialOneMethodCall_IntValueBuffer4", runFunction: run_ExistentialTestPassExistentialOneMethodCall_IntValueBuffer4, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer1", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer1, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer2", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer2, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer3", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer3, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer4", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_ClassValueBuffer4, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer0", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer0, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer1", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer1, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer2", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer2, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer3", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer3, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer4", runFunction: run_ExistentialTestPassExistentialTwoMethodCalls_IntValueBuffer4, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer1", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer1, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer2", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer2, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer3", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer3, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_ClassValueBuffer4", runFunction: run_ExistentialTestTwoMethodCalls_ClassValueBuffer4, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer0", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer0, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer1", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer1, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer2", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer2, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer3", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer3, tags: [.unstable]),
BenchmarkInfo(name: "ExistentialTestTwoMethodCalls_IntValueBuffer4", runFunction: run_ExistentialTestTwoMethodCalls_IntValueBuffer4, tags: [.unstable]),
]
protocol Existential { protocol Existential {
init() init()
func doIt() -> Bool func doIt() -> Bool

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let Fibonacci = BenchmarkInfo(
name: "Fibonacci",
runFunction: run_Fibonacci,
tags: [.unstable, .algorithm])
func fibonacci(_ n: Int) -> Int { func fibonacci(_ n: Int) -> Int {
if (n < 2) { return 1 } if (n < 2) { return 1 }
return fibonacci(n - 2) + fibonacci(n - 1) return fibonacci(n - 2) + fibonacci(n - 1)

View File

@@ -15,6 +15,11 @@
import Foundation import Foundation
import TestsUtils import TestsUtils
public let Hanoi = BenchmarkInfo(
name: "Hanoi",
runFunction: run_Hanoi,
tags: [.validation, .algorithm])
struct Move { struct Move {
var from: String var from: String
var to: String var to: String

View File

@@ -15,6 +15,11 @@
// http://en.wikipedia.org/wiki/SHA-1 // http://en.wikipedia.org/wiki/SHA-1
import TestsUtils import TestsUtils
public let HashTest = BenchmarkInfo(
name: "HashTest",
runFunction: run_HashTest,
tags: [.validation, .algorithm])
class Hash { class Hash {
/// \brief C'tor. /// \brief C'tor.
init(_ bs: Int) { init(_ bs: Int) {

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let HashQuadratic = BenchmarkInfo(
name: "HashQuadratic",
runFunction: run_HashQuadratic,
tags: [.unstable, .api, .Dictionary])
let size = 3_000_000 let size = 3_000_000
@inline(never) @inline(never)

View File

@@ -14,6 +14,11 @@
// <rdar://problem/17384894> // <rdar://problem/17384894>
import TestsUtils import TestsUtils
public let Histogram = BenchmarkInfo(
name: "Histogram",
runFunction: run_Histogram,
tags: [.validation, .algorithm])
typealias rrggbb_t = UInt32 typealias rrggbb_t = UInt32
func output_sorted_sparse_rgb_histogram<S: Sequence>(_ samples: S, _ N: Int) func output_sorted_sparse_rgb_histogram<S: Sequence>(_ samples: S, _ N: Int)

View File

@@ -15,6 +15,11 @@ import TestsUtils
// A micro-benchmark for recursive divide and conquer problems. // A micro-benchmark for recursive divide and conquer problems.
// The program performs integration via Gaussian Quadrature // The program performs integration via Gaussian Quadrature
public let IntegrateTest = BenchmarkInfo(
name: "Integrate",
runFunction: run_Integrate,
tags: [.validation, .algorithm])
class Integrate { class Integrate {
static let epsilon = 1.0e-9 static let epsilon = 1.0e-9

View File

@@ -13,6 +13,11 @@
import TestsUtils import TestsUtils
import Foundation import Foundation
public let IterateData = BenchmarkInfo(
name: "IterateData",
runFunction: run_IterateData,
tags: [.validation, .api])
@inline(never) @inline(never)
func generateData() -> Data { func generateData() -> Data {
var data = Data(count: 16 * 1024) var data = Data(count: 16 * 1024)

View File

@@ -13,6 +13,11 @@
// This test tests the performance of ASCII Character comparison. // This test tests the performance of ASCII Character comparison.
import TestsUtils import TestsUtils
public let Join = BenchmarkInfo(
name: "Join",
runFunction: run_Join,
tags: [.validation, .api, .String, .Array])
@inline(never) @inline(never)
public func run_Join(_ N: Int) { public func run_Join(_ N: Int) {
var array: [String] = [] var array: [String] = []

View File

@@ -14,6 +14,11 @@
// collections. // collections.
import TestsUtils import TestsUtils
public let LazyFilter = [
BenchmarkInfo(name: "LazilyFilteredArrays", runFunction: run_LazilyFilteredArrays, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "LazilyFilteredRange", runFunction: run_LazilyFilteredRange, tags: [.validation, .api, .Array]),
]
@inline(never) @inline(never)
public func run_LazilyFilteredRange(_ N: Int) { public func run_LazilyFilteredRange(_ N: Int) {
var res = 123 var res = 123

View File

@@ -13,6 +13,21 @@
import TestsUtils import TestsUtils
import Foundation import Foundation
public let MapReduce = [
BenchmarkInfo(name: "MapReduce", runFunction: run_MapReduce, tags: [.validation, .algorithm]),
BenchmarkInfo(name: "MapReduceAnyCollection", runFunction: run_MapReduceAnyCollection, tags: [.validation, .algorithm]),
BenchmarkInfo(name: "MapReduceAnyCollectionShort", runFunction: run_MapReduceAnyCollectionShort, tags: [.validation, .algorithm]),
BenchmarkInfo(name: "MapReduceClass", runFunction: run_MapReduceClass, tags: [.validation, .algorithm]),
BenchmarkInfo(name: "MapReduceClassShort", runFunction: run_MapReduceClassShort, tags: [.validation, .algorithm]),
BenchmarkInfo(name: "MapReduceLazyCollection", runFunction: run_MapReduceLazyCollection, tags: [.validation, .algorithm]),
BenchmarkInfo(name: "MapReduceLazyCollectionShort", runFunction: run_MapReduceLazyCollectionShort, tags: [.validation, .algorithm]),
BenchmarkInfo(name: "MapReduceLazySequence", runFunction: run_MapReduceLazySequence, tags: [.validation, .algorithm]),
BenchmarkInfo(name: "MapReduceSequence", runFunction: run_MapReduceSequence, tags: [.validation, .algorithm]),
BenchmarkInfo(name: "MapReduceShort", runFunction: run_MapReduceShort, tags: [.validation, .algorithm]),
BenchmarkInfo(name: "MapReduceShortString", runFunction: run_MapReduceShortString, tags: [.validation, .algorithm, .String]),
BenchmarkInfo(name: "MapReduceString", runFunction: run_MapReduceString, tags: [.validation, .algorithm, .String]),
]
@inline(never) @inline(never)
public func run_MapReduce(_ N: Int) { public func run_MapReduce(_ N: Int) {
var numbers = [Int](0..<1000) var numbers = [Int](0..<1000)

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let Memset = BenchmarkInfo(
name: "Memset",
runFunction: run_Memset,
tags: [.validation])
@inline(never) @inline(never)
func memset(_ a: inout [Int], _ c: Int) { func memset(_ a: inout [Int], _ c: Int) {
for i in 0..<a.count { for i in 0..<a.count {

View File

@@ -19,6 +19,11 @@
// Thus, e = N / Nempty. // Thus, e = N / Nempty.
import TestsUtils import TestsUtils
public let MonteCarloE = BenchmarkInfo(
name: "MonteCarloE",
runFunction: run_MonteCarloE,
tags: [.validation, .algorithm])
public func run_MonteCarloE(scale: Int) { public func run_MonteCarloE(scale: Int) {
let N = 200000*scale let N = 200000*scale
var intervals = [Bool](repeating: false, count: N) var intervals = [Bool](repeating: false, count: N)

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let MonteCarloPi = BenchmarkInfo(
name: "MonteCarloPi",
runFunction: run_MonteCarloPi,
tags: [.validation, .algorithm])
public func run_MonteCarloPi(scale: Int) { public func run_MonteCarloPi(scale: Int) {
var pointsInside = 0 var pointsInside = 0
let r = 10000 let r = 10000

View File

@@ -18,6 +18,11 @@
import Foundation import Foundation
import TestsUtils import TestsUtils
public let NSDictionaryCastToSwift = BenchmarkInfo(
name: "NSDictionaryCastToSwift",
runFunction: run_NSDictionaryCastToSwift,
tags: [.validation, .api, .Dictionary, .bridging])
@inline(never) @inline(never)
public func run_NSDictionaryCastToSwift(_ N: Int) { public func run_NSDictionaryCastToSwift(_ N: Int) {
#if _runtime(_ObjC) #if _runtime(_ObjC)

View File

@@ -13,6 +13,11 @@
import TestsUtils import TestsUtils
import Foundation import Foundation
public let NSErrorTest = BenchmarkInfo(
name: "NSError",
runFunction: run_NSError,
tags: [.validation, .exceptions, .bridging])
protocol P { protocol P {
func buzz() throws -> Int func buzz() throws -> Int
} }

View File

@@ -14,6 +14,11 @@
import TestsUtils import TestsUtils
import Foundation import Foundation
public let NSStringConversion = BenchmarkInfo(
name: "NSStringConversion",
runFunction: run_NSStringConversion,
tags: [.validation, .api, .String, .bridging])
public func run_NSStringConversion(_ N: Int) { public func run_NSStringConversion(_ N: Int) {
#if _runtime(_ObjC) #if _runtime(_ObjC)
let test:NSString = NSString(cString: "test", encoding: String.Encoding.ascii.rawValue)! let test:NSString = NSString(cString: "test", encoding: String.Encoding.ascii.rawValue)!

View File

@@ -13,6 +13,11 @@
// <rdar://problem/17838787> // <rdar://problem/17838787>
import TestsUtils import TestsUtils
public let NopDeinit = BenchmarkInfo(
name: "NopDeinit",
runFunction: run_NopDeinit,
tags: [.regression])
class X<T : Comparable> { class X<T : Comparable> {
let deinitIters = 10000 let deinitIters = 10000
var elem: T var elem: T

View File

@@ -13,6 +13,27 @@
import TestsUtils import TestsUtils
import Foundation import Foundation
public let ObjectiveCBridging = [
BenchmarkInfo(name: "ObjectiveCBridgeFromNSString", runFunction: run_ObjectiveCBridgeFromNSString, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeFromNSStringForced", runFunction: run_ObjectiveCBridgeFromNSStringForced, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeToNSString", runFunction: run_ObjectiveCBridgeToNSString, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeFromNSArrayAnyObject", runFunction: run_ObjectiveCBridgeFromNSArrayAnyObject, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeFromNSArrayAnyObjectForced", runFunction: run_ObjectiveCBridgeFromNSArrayAnyObjectForced, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeToNSArray", runFunction: run_ObjectiveCBridgeToNSArray, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeFromNSArrayAnyObjectToString", runFunction: run_ObjectiveCBridgeFromNSArrayAnyObjectToString, tags: [.validation, .bridging, .String]),
BenchmarkInfo(name: "ObjectiveCBridgeFromNSArrayAnyObjectToStringForced", runFunction: run_ObjectiveCBridgeFromNSArrayAnyObjectToStringForced, tags: [.validation, .bridging, .String]),
BenchmarkInfo(name: "ObjectiveCBridgeFromNSDictionaryAnyObject", runFunction: run_ObjectiveCBridgeFromNSDictionaryAnyObject, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeFromNSDictionaryAnyObjectForced", runFunction: run_ObjectiveCBridgeFromNSDictionaryAnyObjectForced, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeToNSDictionary", runFunction: run_ObjectiveCBridgeToNSDictionary, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeFromNSDictionaryAnyObjectToString", runFunction: run_ObjectiveCBridgeFromNSDictionaryAnyObjectToString, tags: [.validation, .bridging, .String]),
BenchmarkInfo(name: "ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced", runFunction: run_ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced, tags: [.validation, .bridging, .String]),
BenchmarkInfo(name: "ObjectiveCBridgeFromNSSetAnyObject", runFunction: run_ObjectiveCBridgeFromNSSetAnyObject, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeFromNSSetAnyObjectForced", runFunction: run_ObjectiveCBridgeFromNSSetAnyObjectForced, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeToNSSet", runFunction: run_ObjectiveCBridgeToNSSet, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeFromNSSetAnyObjectToString", runFunction: run_ObjectiveCBridgeFromNSSetAnyObjectToString, tags: [.validation, .bridging, .String]),
BenchmarkInfo(name: "ObjectiveCBridgeFromNSSetAnyObjectToStringForced", runFunction: run_ObjectiveCBridgeFromNSSetAnyObjectToStringForced, tags: [.validation, .bridging, .String]),
]
#if _runtime(_ObjC) #if _runtime(_ObjC)
@inline(never) @inline(never)
public func forcedCast<NS, T>(_ ns: NS) -> T { public func forcedCast<NS, T>(_ ns: NS) -> T {

View File

@@ -16,6 +16,19 @@ import Foundation
import ObjectiveCTests import ObjectiveCTests
#endif #endif
public let ObjectiveCBridgingStubs = [
BenchmarkInfo(name: "ObjectiveCBridgeStubDataAppend", runFunction: run_ObjectiveCBridgeStubDataAppend, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubDateAccess", runFunction: run_ObjectiveCBridgeStubDateAccess, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubDateMutation", runFunction: run_ObjectiveCBridgeStubDateMutation, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubFromArrayOfNSString", runFunction: run_ObjectiveCBridgeStubFromArrayOfNSString, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubFromNSDate", runFunction: run_ObjectiveCBridgeStubFromNSDate, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubFromNSString", runFunction: run_ObjectiveCBridgeStubFromNSString, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubToArrayOfNSString", runFunction: run_ObjectiveCBridgeStubToArrayOfNSString, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubToNSDate", runFunction: run_ObjectiveCBridgeStubToNSDate, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubToNSString", runFunction: run_ObjectiveCBridgeStubToNSString, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubURLAppendPath", runFunction: run_ObjectiveCBridgeStubURLAppendPath, tags: [.validation, .bridging]),
]
#if _runtime(_ObjC) #if _runtime(_ObjC)
@inline(never) @inline(never)
func testObjectiveCBridgeStubFromNSString() { func testObjectiveCBridgeStubFromNSString() {

View File

@@ -21,6 +21,17 @@ import Foundation
import ObjectiveCTests import ObjectiveCTests
#endif #endif
public let ObjectiveCNoBridgingStubs = [
BenchmarkInfo(name: "ObjectiveCBridgeStubToNSStringRef", runFunction: run_ObjectiveCBridgeStubToNSStringRef, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubToNSDateRef", runFunction: run_ObjectiveCBridgeStubToNSDateRef, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubNSDateRefAccess", runFunction: run_ObjectiveCBridgeStubNSDateRefAccess, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubNSDateMutationRef", runFunction: run_ObjectiveCBridgeStubNSDateMutationRef, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubNSDataAppend", runFunction: run_ObjectiveCBridgeStubNSDataAppend, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubFromNSStringRef", runFunction: run_ObjectiveCBridgeStubFromNSStringRef, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubFromNSDateRef", runFunction: run_ObjectiveCBridgeStubFromNSDateRef, tags: [.validation, .bridging]),
BenchmarkInfo(name: "ObjectiveCBridgeStubURLAppendPathRef", runFunction: run_ObjectiveCBridgeStubURLAppendPathRef, tags: [.validation, .bridging]),
]
#if _runtime(_ObjC) #if _runtime(_ObjC)
@inline(never) @inline(never)
func testObjectiveCBridgeStubFromNSStringRef() { func testObjectiveCBridgeStubFromNSStringRef() {

View File

@@ -10,6 +10,14 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils
public let ObserverClosure = BenchmarkInfo(
name: "ObserverClosure",
runFunction: run_ObserverClosure,
tags: [.validation])
class Observer { class Observer {
@inline(never) @inline(never)
func receive(_ value: Int) { func receive(_ value: Int) {

View File

@@ -10,6 +10,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils
public let ObserverForwarderStruct = BenchmarkInfo(
name: "ObserverForwarderStruct",
runFunction: run_ObserverForwarderStruct,
tags: [.validation])
class Observer { class Observer {
@inline(never) @inline(never)
func receive(_ value: Int) { func receive(_ value: Int) {

View File

@@ -10,6 +10,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils
public let ObserverPartiallyAppliedMethod = BenchmarkInfo(
name: "ObserverPartiallyAppliedMethod",
runFunction: run_ObserverPartiallyAppliedMethod,
tags: [.validation])
class Observer { class Observer {
@inline(never) @inline(never)
func receive(_ value: Int) { func receive(_ value: Int) {

View File

@@ -10,6 +10,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils
public let ObserverUnappliedMethod = BenchmarkInfo(
name: "ObserverUnappliedMethod",
runFunction: run_ObserverUnappliedMethod,
tags: [.validation])
class Observer { class Observer {
@inline(never) @inline(never)
func receive(_ value: Int) { func receive(_ value: Int) {

View File

@@ -15,6 +15,10 @@ import Foundation
// A micro benchmark for checking the speed of string-based enums. // A micro benchmark for checking the speed of string-based enums.
public let OpenClose = BenchmarkInfo(
name: "OpenClose",
runFunction: run_OpenClose,
tags: [.validation, .api, .String])
enum MyState : String { enum MyState : String {
case Closed = "Closed" case Closed = "Closed"

View File

@@ -14,6 +14,11 @@
// for performance measuring. // for performance measuring.
import TestsUtils import TestsUtils
public let Phonebook = BenchmarkInfo(
name: "Phonebook",
runFunction: run_Phonebook,
tags: [.validation, .api, .String])
var words = [ var words = [
"James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph", "James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph",
"Charles", "Thomas", "Christopher", "Daniel", "Matthew", "Donald", "Anthony", "Charles", "Thomas", "Christopher", "Daniel", "Matthew", "Donald", "Anthony",

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let PopFront = [
BenchmarkInfo(name: "PopFrontArray", runFunction: run_PopFrontArray, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "PopFrontUnsafePointer", runFunction: run_PopFrontUnsafePointer, tags: [.validation, .api]),
]
let reps = 1 let reps = 1
let arrayCount = 1024 let arrayCount = 1024

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let PopFrontArrayGeneric = BenchmarkInfo(
name: "PopFrontArrayGeneric",
runFunction: run_PopFrontArrayGeneric,
tags: [.validation, .api, .Array])
let reps = 1 let reps = 1
let arrayCount = 1024 let arrayCount = 1024

View File

@@ -22,6 +22,65 @@ let sequenceCount = 4096
let prefixCount = sequenceCount - 1024 let prefixCount = sequenceCount - 1024
let sumCount = prefixCount * (prefixCount - 1) / 2 let sumCount = prefixCount * (prefixCount - 1) / 2
public let Prefix = [
BenchmarkInfo(
name: "PrefixCountableRange",
runFunction: run_PrefixCountableRange,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixSequence",
runFunction: run_PrefixSequence,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixAnySequence",
runFunction: run_PrefixAnySequence,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixAnySeqCntRange",
runFunction: run_PrefixAnySeqCntRange,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixAnySeqCRangeIter",
runFunction: run_PrefixAnySeqCRangeIter,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixAnyCollection",
runFunction: run_PrefixAnyCollection,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixArray",
runFunction: run_PrefixArray,
tags: [.validation, .api, .Array]),
BenchmarkInfo(
name: "PrefixCountableRangeLazy",
runFunction: run_PrefixCountableRangeLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixSequenceLazy",
runFunction: run_PrefixSequenceLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixAnySequenceLazy",
runFunction: run_PrefixAnySequenceLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixAnySeqCntRangeLazy",
runFunction: run_PrefixAnySeqCntRangeLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixAnySeqCRangeIterLazy",
runFunction: run_PrefixAnySeqCRangeIterLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixAnyCollectionLazy",
runFunction: run_PrefixAnyCollectionLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixArrayLazy",
runFunction: run_PrefixArrayLazy,
tags: [.validation, .api]),
]
@inline(never) @inline(never)
public func run_PrefixCountableRange(_ N: Int) { public func run_PrefixCountableRange(_ N: Int) {
let s = 0..<sequenceCount let s = 0..<sequenceCount

View File

@@ -41,6 +41,15 @@ def lazy ((Name, Expr)) : return (Name + 'Lazy', '(' + Expr + ').lazy')
Sequences = Sequences + map(lazy, Sequences) Sequences = Sequences + map(lazy, Sequences)
}% }%
public let Prefix = [
% for (Name, Expr) in Sequences:
BenchmarkInfo(
name: "Prefix${Name}",
runFunction: run_Prefix${Name},
tags: [.validation, .api${', .Array' if Name == 'Array' else ''}]),
% end
]
% for (Name, Expr) in Sequences: % for (Name, Expr) in Sequences:
@inline(never) @inline(never)
public func run_Prefix${Name}(_ N: Int) { public func run_Prefix${Name}(_ N: Int) {

View File

@@ -22,6 +22,65 @@ let sequenceCount = 4096
let prefixCount = sequenceCount - 1024 let prefixCount = sequenceCount - 1024
let sumCount = prefixCount * (prefixCount - 1) / 2 let sumCount = prefixCount * (prefixCount - 1) / 2
public let PrefixWhile = [
BenchmarkInfo(
name: "PrefixWhileCountableRange",
runFunction: run_PrefixWhileCountableRange,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixWhileSequence",
runFunction: run_PrefixWhileSequence,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixWhileAnySequence",
runFunction: run_PrefixWhileAnySequence,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixWhileAnySeqCntRange",
runFunction: run_PrefixWhileAnySeqCntRange,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixWhileAnySeqCRangeIter",
runFunction: run_PrefixWhileAnySeqCRangeIter,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixWhileAnyCollection",
runFunction: run_PrefixWhileAnyCollection,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixWhileArray",
runFunction: run_PrefixWhileArray,
tags: [.validation, .api, .Array]),
BenchmarkInfo(
name: "PrefixWhileCountableRangeLazy",
runFunction: run_PrefixWhileCountableRangeLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixWhileSequenceLazy",
runFunction: run_PrefixWhileSequenceLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixWhileAnySequenceLazy",
runFunction: run_PrefixWhileAnySequenceLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixWhileAnySeqCntRangeLazy",
runFunction: run_PrefixWhileAnySeqCntRangeLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixWhileAnySeqCRangeIterLazy",
runFunction: run_PrefixWhileAnySeqCRangeIterLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixWhileAnyCollectionLazy",
runFunction: run_PrefixWhileAnyCollectionLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "PrefixWhileArrayLazy",
runFunction: run_PrefixWhileArrayLazy,
tags: [.validation, .api]),
]
@inline(never) @inline(never)
public func run_PrefixWhileCountableRange(_ N: Int) { public func run_PrefixWhileCountableRange(_ N: Int) {
let s = 0..<sequenceCount let s = 0..<sequenceCount

View File

@@ -41,6 +41,15 @@ def lazy ((Name, Expr)) : return (Name + 'Lazy', '(' + Expr + ').lazy')
Sequences = Sequences + map(lazy, Sequences) Sequences = Sequences + map(lazy, Sequences)
}% }%
public let PrefixWhile = [
% for (Name, Expr) in Sequences:
BenchmarkInfo(
name: "PrefixWhile${Name}",
runFunction: run_PrefixWhile${Name},
tags: [.validation, .api${', .Array' if Name == 'Array' else ''}]),
% end
]
% for (Name, Expr) in Sequences: % for (Name, Expr) in Sequences:
@inline(never) @inline(never)
public func run_PrefixWhile${Name}(_ N: Int) { public func run_PrefixWhile${Name}(_ N: Int) {

View File

@@ -22,6 +22,11 @@
// update the heap fast when we add a new node to the tree. // update the heap fast when we add a new node to the tree.
import TestsUtils import TestsUtils
public let Prims = BenchmarkInfo(
name: "Prims",
runFunction: run_Prims,
tags: [.validation, .algorithm])
class PriorityQueue { class PriorityQueue {
final var heap: Array<EdgeCost> final var heap: Array<EdgeCost>
final var graphIndexToHeapIndexMap: Array<Int?> final var graphIndexToHeapIndexMap: Array<Int?>

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let ProtocolDispatch = BenchmarkInfo(
name: "ProtocolDispatch",
runFunction: run_ProtocolDispatch,
tags: [.validation, .abstraction])
@inline(never) @inline(never)
public func run_ProtocolDispatch(_ N: Int) { public func run_ProtocolDispatch(_ N: Int) {

View File

@@ -17,6 +17,11 @@
import TestsUtils import TestsUtils
import Foundation import Foundation
public let ProtocolDispatch2 = BenchmarkInfo(
name: "ProtocolDispatch2",
runFunction: run_ProtocolDispatch2,
tags: [.validation, .abstraction])
protocol Pingable { func ping() -> Int; func pong() -> Int} protocol Pingable { func ping() -> Int; func pong() -> Int}
struct Game : Pingable { struct Game : Pingable {

View File

@@ -14,6 +14,11 @@
// for performance measuring. // for performance measuring.
import TestsUtils import TestsUtils
public let RC4Test = BenchmarkInfo(
name: "RC4",
runFunction: run_RC4,
tags: [.validation, .algorithm])
struct RC4 { struct RC4 {
var State : [UInt8] var State : [UInt8]
var I: UInt8 = 0 var I: UInt8 = 0

View File

@@ -18,6 +18,11 @@
import Foundation import Foundation
import TestsUtils import TestsUtils
public let RGBHistogram = [
BenchmarkInfo(name: "RGBHistogram", runFunction: run_RGBHistogram, tags: [.validation, .algorithm]),
BenchmarkInfo(name: "RGBHistogramOfObjects", runFunction: run_RGBHistogramOfObjects, tags: [.validation, .algorithm]),
]
@inline(never) @inline(never)
public func run_RGBHistogram(_ N: Int) { public func run_RGBHistogram(_ N: Int) {
var histogram = [(key: rrggbb_t, value: Int)]() var histogram = [(key: rrggbb_t, value: Int)]()

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let RangeAssignment = BenchmarkInfo(
name: "RangeAssignment",
runFunction: run_RangeAssignment,
tags: [.validation, .api])
@inline(never) @inline(never)
public func run_RangeAssignment(_ scale: Int) { public func run_RangeAssignment(_ scale: Int) {
let range: Range = 100..<200 let range: Range = 100..<200

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let RecursiveOwnedParameter = BenchmarkInfo(
name: "RecursiveOwnedParameter",
runFunction: run_RecursiveOwnedParameter,
tags: [.validation, .api, .Array, .refcount])
// This test recursively visits each element of an array in a class and compares // This test recursively visits each element of an array in a class and compares
// it with every value in a different array stored in a different class. The // it with every value in a different array stored in a different class. The
// idea is to make sure that we can get rid of the overhead from guaranteed // idea is to make sure that we can get rid of the overhead from guaranteed

View File

@@ -13,6 +13,15 @@
import TestsUtils import TestsUtils
import Foundation import Foundation
public let ReduceInto = [
BenchmarkInfo(name: "FilterEvenUsingReduce", runFunction: run_FilterEvenUsingReduce, tags: [.validation, .api]),
BenchmarkInfo(name: "FilterEvenUsingReduceInto", runFunction: run_FilterEvenUsingReduceInto, tags: [.validation, .api]),
BenchmarkInfo(name: "FrequenciesUsingReduce", runFunction: run_FrequenciesUsingReduce, tags: [.validation, .api]),
BenchmarkInfo(name: "FrequenciesUsingReduceInto", runFunction: run_FrequenciesUsingReduceInto, tags: [.validation, .api]),
BenchmarkInfo(name: "SumUsingReduce", runFunction: run_SumUsingReduce, tags: [.validation, .api]),
BenchmarkInfo(name: "SumUsingReduceInto", runFunction: run_SumUsingReduceInto, tags: [.validation, .api]),
]
// Sum // Sum
@inline(never) @inline(never)

View File

@@ -10,6 +10,14 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils
public let ReversedCollections = [
BenchmarkInfo(name: "ReversedArray", runFunction: run_ReversedArray, tags: [.validation, .api, .Array]),
BenchmarkInfo(name: "ReversedBidirectional", runFunction: run_ReversedBidirectional, tags: [.validation, .api]),
BenchmarkInfo(name: "ReversedDictionary", runFunction: run_ReversedDictionary, tags: [.validation, .api, .Dictionary]),
]
// These benchmarks compare the performance of iteration through several // These benchmarks compare the performance of iteration through several
// collection types after being reversed. // collection types after being reversed.
var x = 0 var x = 0

View File

@@ -12,6 +12,17 @@
import TestsUtils import TestsUtils
public let SetTests = [
BenchmarkInfo(name: "SetExclusiveOr", runFunction: run_SetExclusiveOr, tags: [.validation, .api, .Set]),
BenchmarkInfo(name: "SetExclusiveOr_OfObjects", runFunction: run_SetExclusiveOr_OfObjects, tags: [.validation, .api, .Set]),
BenchmarkInfo(name: "SetIntersect", runFunction: run_SetIntersect, tags: [.validation, .api, .Set]),
BenchmarkInfo(name: "SetIntersect_OfObjects", runFunction: run_SetIntersect_OfObjects, tags: [.validation, .api, .Set]),
BenchmarkInfo(name: "SetIsSubsetOf", runFunction: run_SetIsSubsetOf, tags: [.validation, .api, .Set]),
BenchmarkInfo(name: "SetIsSubsetOf_OfObjects", runFunction: run_SetIsSubsetOf_OfObjects, tags: [.validation, .api, .Set]),
BenchmarkInfo(name: "SetUnion", runFunction: run_SetUnion, tags: [.validation, .api, .Set]),
BenchmarkInfo(name: "SetUnion_OfObjects", runFunction: run_SetUnion_OfObjects, tags: [.validation, .api, .Set]),
]
@inline(never) @inline(never)
public func run_SetIsSubsetOf(_ N: Int) { public func run_SetIsSubsetOf(_ N: Int) {
let size = 200 let size = 200

View File

@@ -9,6 +9,12 @@
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils
public let Sim2DArray = BenchmarkInfo(
name: "Sim2DArray",
runFunction: run_Sim2DArray,
tags: [.validation, .api, .Array])
struct Array2D { struct Array2D {
var storage : [Int] var storage : [Int]

View File

@@ -14,6 +14,11 @@
import TestsUtils import TestsUtils
public let SortLargeExistentials = BenchmarkInfo(
name: "SortLargeExistentials",
runFunction: run_SortLargeExistentials,
tags: [.validation, .api, .algorithm])
protocol LetterKind { protocol LetterKind {
var value: String { get } var value: String { get }
func lessthan(_ rhs: LetterKind) -> Bool func lessthan(_ rhs: LetterKind) -> Bool

View File

@@ -15,6 +15,11 @@
import Foundation import Foundation
import TestsUtils import TestsUtils
public let SortLettersInPlace = BenchmarkInfo(
name: "SortLettersInPlace",
runFunction: run_SortLettersInPlace,
tags: [.validation, .api, .algorithm, .String])
class Letter { class Letter {
let value: String let value: String
init(_ value: String) { init(_ value: String) {

View File

@@ -9,8 +9,14 @@
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils
// Sort an array of strings using an explicit sort predicate. // Sort an array of strings using an explicit sort predicate.
public let SortStrings = [
BenchmarkInfo(name: "SortSortedStrings", runFunction: run_SortSortedStrings, tags: [.validation, .api, .algorithm, .String]),
BenchmarkInfo(name: "SortStrings", runFunction: run_SortStrings, tags: [.validation, .api, .algorithm, .String]),
BenchmarkInfo(name: "SortStringsUnicode", runFunction: run_SortStringsUnicode, tags: [.validation, .api, .algorithm, .String]),
]
var stringBenchmarkWords: [String] = [ var stringBenchmarkWords: [String] = [
"woodshed", "woodshed",

View File

@@ -9,6 +9,12 @@
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils
public let StackPromo = BenchmarkInfo(
name: "StackPromo",
runFunction: run_StackPromo,
tags: [.regression])
protocol Proto { protocol Proto {
func at() -> Int func at() -> Int

View File

@@ -16,6 +16,11 @@
import TestsUtils import TestsUtils
public let StaticArrayTest = BenchmarkInfo(
name: "StaticArray",
runFunction: run_StaticArray,
tags: [.validation, .api, .Array])
protocol StaticArrayProtocol { protocol StaticArrayProtocol {
associatedtype ElemTy associatedtype ElemTy
init(_ defaultValue : ElemTy) init(_ defaultValue : ElemTy)

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let StrComplexWalk = BenchmarkInfo(
name: "StrComplexWalk",
runFunction: run_StrComplexWalk,
tags: [.validation, .api, .String])
@inline(never) @inline(never)
public func run_StrComplexWalk(_ N: Int) { public func run_StrComplexWalk(_ N: Int) {
var s = "निरन्तरान्धकारिता-दिगन्तर-कन्दलदमन्द-सुधारस-बिन्दु-सान्द्रतर-घनाघन-वृन्द-सन्देहकर-स्यन्दमान-मकरन्द-बिन्दु-बन्धुरतर-माकन्द-तरु-कुल-तल्प-कल्प-मृदुल-सिकता-जाल-जटिल-मूल-तल-मरुवक-मिलदलघु-लघु-लय-कलित-रमणीय-पानीय-शालिका-बालिका-करार-विन्द-गलन्तिका-गलदेला-लवङ्ग-पाटल-घनसार-कस्तूरिकातिसौरभ-मेदुर-लघुतर-मधुर-शीतलतर-सलिलधारा-निराकरिष्णु-तदीय-विमल-विलोचन-मयूख-रेखापसारित-पिपासायास-पथिक-लोकान्" var s = "निरन्तरान्धकारिता-दिगन्तर-कन्दलदमन्द-सुधारस-बिन्दु-सान्द्रतर-घनाघन-वृन्द-सन्देहकर-स्यन्दमान-मकरन्द-बिन्दु-बन्धुरतर-माकन्द-तरु-कुल-तल्प-कल्प-मृदुल-सिकता-जाल-जटिल-मूल-तल-मरुवक-मिलदलघु-लघु-लय-कलित-रमणीय-पानीय-शालिका-बालिका-करार-विन्द-गलन्तिका-गलदेला-लवङ्ग-पाटल-घनसार-कस्तूरिकातिसौरभ-मेदुर-लघुतर-मधुर-शीतलतर-सलिलधारा-निराकरिष्णु-तदीय-विमल-विलोचन-मयूख-रेखापसारित-पिपासायास-पथिक-लोकान्"

View File

@@ -14,6 +14,11 @@
// It is reported to be very slow: <rdar://problem/17255477> // It is reported to be very slow: <rdar://problem/17255477>
import TestsUtils import TestsUtils
public let StrToInt = BenchmarkInfo(
name: "StrToInt",
runFunction: run_StrToInt,
tags: [.validation, .api, .String])
@inline(never) @inline(never)
public func run_StrToInt(_ N: Int) { public func run_StrToInt(_ N: Int) {
// 64 numbers from -500_000 to 500_000 generated randomly // 64 numbers from -500_000 to 500_000 generated randomly

View File

@@ -12,6 +12,13 @@
import TestsUtils import TestsUtils
public let StringBuilder = [
BenchmarkInfo(name: "StringAdder", runFunction: run_StringAdder, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "StringBuilder", runFunction: run_StringBuilder, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "StringBuilderLong", runFunction: run_StringBuilderLong, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "StringUTF16Builder", runFunction: run_StringUTF16Builder, tags: [.validation, .api, .String]),
]
@inline(never) @inline(never)
func buildString(_ i: String) -> String { func buildString(_ i: String) -> String {
var sb = i var sb = i

View File

@@ -17,6 +17,11 @@ import Glibc
import Darwin import Darwin
#endif #endif
public let StringEdits = BenchmarkInfo(
name: "StringEdits",
runFunction: run_StringEdits,
tags: [.validation, .api, .String])
var editWords: [String] = [ var editWords: [String] = [
"woodshed", "woodshed",
"lakism", "lakism",

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let StringEnum = BenchmarkInfo(
name: "StringEnumRawValueInitialization",
runFunction: run_StringEnumRawValueInitialization,
tags: [.validation, .api, .String])
enum TestEnum : String { enum TestEnum : String {
case c1 = "Swift" case c1 = "Swift"
case c2 = "is" case c2 = "is"

View File

@@ -12,6 +12,11 @@
import TestsUtils import TestsUtils
public let StringInterpolation = BenchmarkInfo(
name: "StringInterpolation",
runFunction: run_StringInterpolation,
tags: [.validation, .api, .String])
class RefTypePrintable : CustomStringConvertible { class RefTypePrintable : CustomStringConvertible {
var description: String { var description: String {
return "01234567890123456789012345678901234567890123456789" return "01234567890123456789012345678901234567890123456789"

View File

@@ -17,6 +17,11 @@ import Glibc
import Darwin import Darwin
#endif #endif
public let StringMatch = BenchmarkInfo(
name: "StringMatch",
runFunction: run_StringMatch,
tags: [.validation, .api, .String])
extension String { extension String {
@inline(__always) @inline(__always)
func dropFirst(_ n: Int = 1) -> String { func dropFirst(_ n: Int = 1) -> String {

View File

@@ -11,6 +11,14 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
import TestsUtils import TestsUtils
public let StringTests = [
BenchmarkInfo(name: "StringEqualPointerComparison", runFunction: run_StringEqualPointerComparison, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "StringHasPrefix", runFunction: run_StringHasPrefix, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "StringHasPrefixUnicode", runFunction: run_StringHasPrefixUnicode, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "StringHasSuffix", runFunction: run_StringHasSuffix, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "StringHasSuffixUnicode", runFunction: run_StringHasSuffixUnicode, tags: [.validation, .api, .String]),
]
// FIXME(string) // FIXME(string)
public func run_StringHasPrefix(_ N: Int) { public func run_StringHasPrefix(_ N: Int) {
#if _runtime(_ObjC) #if _runtime(_ObjC)

View File

@@ -89,6 +89,413 @@ let unicodeScalarsMultiplier = baseMultiplier
let charactersMultiplier = baseMultiplier / 5 let charactersMultiplier = baseMultiplier / 5
// An extended benchmark suite exercising finer-granularity behavior of our
// Strings.
public var StringWalk = [
BenchmarkInfo(
name: "StringWalk",
runFunction: run_StringWalk,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_ascii_unicodeScalars",
runFunction: run_StringWalk_ascii_unicodeScalars,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_ascii_characters",
runFunction: run_StringWalk_ascii_characters,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_ascii_unicodeScalars",
runFunction: run_CharIteration_ascii_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_ascii_unicodeScalars",
runFunction: run_CharIndexing_ascii_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_ascii_unicodeScalars_Backwards",
runFunction: run_StringWalk_ascii_unicodeScalars_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_ascii_characters_Backwards",
runFunction: run_StringWalk_ascii_characters_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_ascii_unicodeScalars_Backwards",
runFunction: run_CharIteration_ascii_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_ascii_unicodeScalars_Backwards",
runFunction: run_CharIndexing_ascii_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_utf16_unicodeScalars",
runFunction: run_StringWalk_utf16_unicodeScalars,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_utf16_characters",
runFunction: run_StringWalk_utf16_characters,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_utf16_unicodeScalars",
runFunction: run_CharIteration_utf16_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_utf16_unicodeScalars",
runFunction: run_CharIndexing_utf16_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_utf16_unicodeScalars_Backwards",
runFunction: run_StringWalk_utf16_unicodeScalars_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_utf16_characters_Backwards",
runFunction: run_StringWalk_utf16_characters_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_utf16_unicodeScalars_Backwards",
runFunction: run_CharIteration_utf16_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_utf16_unicodeScalars_Backwards",
runFunction: run_CharIndexing_utf16_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_tweet_unicodeScalars",
runFunction: run_StringWalk_tweet_unicodeScalars,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_tweet_characters",
runFunction: run_StringWalk_tweet_characters,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_tweet_unicodeScalars",
runFunction: run_CharIteration_tweet_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_tweet_unicodeScalars",
runFunction: run_CharIndexing_tweet_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_tweet_unicodeScalars_Backwards",
runFunction: run_StringWalk_tweet_unicodeScalars_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_tweet_characters_Backwards",
runFunction: run_StringWalk_tweet_characters_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_tweet_unicodeScalars_Backwards",
runFunction: run_CharIteration_tweet_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_tweet_unicodeScalars_Backwards",
runFunction: run_CharIndexing_tweet_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_japanese_unicodeScalars",
runFunction: run_StringWalk_japanese_unicodeScalars,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_japanese_characters",
runFunction: run_StringWalk_japanese_characters,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_japanese_unicodeScalars",
runFunction: run_CharIteration_japanese_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_japanese_unicodeScalars",
runFunction: run_CharIndexing_japanese_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_japanese_unicodeScalars_Backwards",
runFunction: run_StringWalk_japanese_unicodeScalars_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_japanese_characters_Backwards",
runFunction: run_StringWalk_japanese_characters_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_japanese_unicodeScalars_Backwards",
runFunction: run_CharIteration_japanese_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_japanese_unicodeScalars_Backwards",
runFunction: run_CharIndexing_japanese_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_chinese_unicodeScalars",
runFunction: run_StringWalk_chinese_unicodeScalars,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_chinese_characters",
runFunction: run_StringWalk_chinese_characters,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_chinese_unicodeScalars",
runFunction: run_CharIteration_chinese_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_chinese_unicodeScalars",
runFunction: run_CharIndexing_chinese_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_chinese_unicodeScalars_Backwards",
runFunction: run_StringWalk_chinese_unicodeScalars_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_chinese_characters_Backwards",
runFunction: run_StringWalk_chinese_characters_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_chinese_unicodeScalars_Backwards",
runFunction: run_CharIteration_chinese_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_chinese_unicodeScalars_Backwards",
runFunction: run_CharIndexing_chinese_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_korean_unicodeScalars",
runFunction: run_StringWalk_korean_unicodeScalars,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_korean_characters",
runFunction: run_StringWalk_korean_characters,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_korean_unicodeScalars",
runFunction: run_CharIteration_korean_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_korean_unicodeScalars",
runFunction: run_CharIndexing_korean_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_korean_unicodeScalars_Backwards",
runFunction: run_StringWalk_korean_unicodeScalars_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_korean_characters_Backwards",
runFunction: run_StringWalk_korean_characters_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_korean_unicodeScalars_Backwards",
runFunction: run_CharIteration_korean_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_korean_unicodeScalars_Backwards",
runFunction: run_CharIndexing_korean_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_russian_unicodeScalars",
runFunction: run_StringWalk_russian_unicodeScalars,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_russian_characters",
runFunction: run_StringWalk_russian_characters,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_russian_unicodeScalars",
runFunction: run_CharIteration_russian_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_russian_unicodeScalars",
runFunction: run_CharIndexing_russian_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_russian_unicodeScalars_Backwards",
runFunction: run_StringWalk_russian_unicodeScalars_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_russian_characters_Backwards",
runFunction: run_StringWalk_russian_characters_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_russian_unicodeScalars_Backwards",
runFunction: run_CharIteration_russian_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_russian_unicodeScalars_Backwards",
runFunction: run_CharIndexing_russian_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_punctuated_unicodeScalars",
runFunction: run_StringWalk_punctuated_unicodeScalars,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_punctuated_characters",
runFunction: run_StringWalk_punctuated_characters,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_punctuated_unicodeScalars",
runFunction: run_CharIteration_punctuated_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_punctuated_unicodeScalars",
runFunction: run_CharIndexing_punctuated_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_punctuated_unicodeScalars_Backwards",
runFunction: run_StringWalk_punctuated_unicodeScalars_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_punctuated_characters_Backwards",
runFunction: run_StringWalk_punctuated_characters_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_punctuated_unicodeScalars_Backwards",
runFunction: run_CharIteration_punctuated_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_punctuated_unicodeScalars_Backwards",
runFunction: run_CharIndexing_punctuated_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_punctuatedJapanese_unicodeScalars",
runFunction: run_StringWalk_punctuatedJapanese_unicodeScalars,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_punctuatedJapanese_characters",
runFunction: run_StringWalk_punctuatedJapanese_characters,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_punctuatedJapanese_unicodeScalars",
runFunction: run_CharIteration_punctuatedJapanese_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_punctuatedJapanese_unicodeScalars",
runFunction: run_CharIndexing_punctuatedJapanese_unicodeScalars,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "StringWalk_punctuatedJapanese_unicodeScalars_Backwards",
runFunction: run_StringWalk_punctuatedJapanese_unicodeScalars_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "StringWalk_punctuatedJapanese_characters_Backwards",
runFunction: run_StringWalk_punctuatedJapanese_characters_Backwards,
tags: [.api, .String, .skip]),
BenchmarkInfo(
name: "CharIteration_punctuatedJapanese_unicodeScalars_Backwards",
runFunction: run_CharIteration_punctuatedJapanese_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_punctuatedJapanese_unicodeScalars_Backwards",
runFunction: run_CharIndexing_punctuatedJapanese_unicodeScalars_Backwards,
tags: [.validation, .api, .String]),
]
@inline(never) @inline(never)
public func run_StringWalk_ascii_unicodeScalars(_ N: Int) { public func run_StringWalk_ascii_unicodeScalars(_ N: Int) {
for _ in 1...unicodeScalarsMultiplier*N { for _ in 1...unicodeScalarsMultiplier*N {
@@ -104,8 +511,6 @@ public func run_StringWalk_ascii_unicodeScalars_Backwards(_ N: Int) {
} }
@inline(never) @inline(never)
public func run_StringWalk_ascii_characters(_ N: Int) { public func run_StringWalk_ascii_characters(_ N: Int) {
for _ in 1...charactersMultiplier*N { for _ in 1...charactersMultiplier*N {
@@ -121,8 +526,6 @@ public func run_StringWalk_ascii_characters_Backwards(_ N: Int) {
} }
let asciiCharacters = Array(ascii) let asciiCharacters = Array(ascii)
@inline(never) @inline(never)
@@ -189,8 +592,6 @@ public func run_StringWalk_utf16_unicodeScalars_Backwards(_ N: Int) {
} }
@inline(never) @inline(never)
public func run_StringWalk_utf16_characters(_ N: Int) { public func run_StringWalk_utf16_characters(_ N: Int) {
for _ in 1...charactersMultiplier*N { for _ in 1...charactersMultiplier*N {
@@ -206,8 +607,6 @@ public func run_StringWalk_utf16_characters_Backwards(_ N: Int) {
} }
let utf16Characters = Array(utf16) let utf16Characters = Array(utf16)
@inline(never) @inline(never)
@@ -274,8 +673,6 @@ public func run_StringWalk_tweet_unicodeScalars_Backwards(_ N: Int) {
} }
@inline(never) @inline(never)
public func run_StringWalk_tweet_characters(_ N: Int) { public func run_StringWalk_tweet_characters(_ N: Int) {
for _ in 1...charactersMultiplier*N { for _ in 1...charactersMultiplier*N {
@@ -291,8 +688,6 @@ public func run_StringWalk_tweet_characters_Backwards(_ N: Int) {
} }
let tweetCharacters = Array(tweet) let tweetCharacters = Array(tweet)
@inline(never) @inline(never)
@@ -359,8 +754,6 @@ public func run_StringWalk_japanese_unicodeScalars_Backwards(_ N: Int) {
} }
@inline(never) @inline(never)
public func run_StringWalk_japanese_characters(_ N: Int) { public func run_StringWalk_japanese_characters(_ N: Int) {
for _ in 1...charactersMultiplier*N { for _ in 1...charactersMultiplier*N {
@@ -376,8 +769,6 @@ public func run_StringWalk_japanese_characters_Backwards(_ N: Int) {
} }
let japaneseCharacters = Array(japanese) let japaneseCharacters = Array(japanese)
@inline(never) @inline(never)
@@ -444,8 +835,6 @@ public func run_StringWalk_chinese_unicodeScalars_Backwards(_ N: Int) {
} }
@inline(never) @inline(never)
public func run_StringWalk_chinese_characters(_ N: Int) { public func run_StringWalk_chinese_characters(_ N: Int) {
for _ in 1...charactersMultiplier*N { for _ in 1...charactersMultiplier*N {
@@ -461,8 +850,6 @@ public func run_StringWalk_chinese_characters_Backwards(_ N: Int) {
} }
let chineseCharacters = Array(chinese) let chineseCharacters = Array(chinese)
@inline(never) @inline(never)
@@ -529,8 +916,6 @@ public func run_StringWalk_korean_unicodeScalars_Backwards(_ N: Int) {
} }
@inline(never) @inline(never)
public func run_StringWalk_korean_characters(_ N: Int) { public func run_StringWalk_korean_characters(_ N: Int) {
for _ in 1...charactersMultiplier*N { for _ in 1...charactersMultiplier*N {
@@ -546,8 +931,6 @@ public func run_StringWalk_korean_characters_Backwards(_ N: Int) {
} }
let koreanCharacters = Array(korean) let koreanCharacters = Array(korean)
@inline(never) @inline(never)
@@ -614,8 +997,6 @@ public func run_StringWalk_russian_unicodeScalars_Backwards(_ N: Int) {
} }
@inline(never) @inline(never)
public func run_StringWalk_russian_characters(_ N: Int) { public func run_StringWalk_russian_characters(_ N: Int) {
for _ in 1...charactersMultiplier*N { for _ in 1...charactersMultiplier*N {
@@ -631,8 +1012,6 @@ public func run_StringWalk_russian_characters_Backwards(_ N: Int) {
} }
let russianCharacters = Array(russian) let russianCharacters = Array(russian)
@inline(never) @inline(never)
@@ -699,8 +1078,6 @@ public func run_StringWalk_punctuated_unicodeScalars_Backwards(_ N: Int) {
} }
@inline(never) @inline(never)
public func run_StringWalk_punctuated_characters(_ N: Int) { public func run_StringWalk_punctuated_characters(_ N: Int) {
for _ in 1...charactersMultiplier*N { for _ in 1...charactersMultiplier*N {
@@ -716,8 +1093,6 @@ public func run_StringWalk_punctuated_characters_Backwards(_ N: Int) {
} }
let punctuatedCharacters = Array(punctuated) let punctuatedCharacters = Array(punctuated)
@inline(never) @inline(never)
@@ -784,8 +1159,6 @@ public func run_StringWalk_punctuatedJapanese_unicodeScalars_Backwards(_ N: Int)
} }
@inline(never) @inline(never)
public func run_StringWalk_punctuatedJapanese_characters(_ N: Int) { public func run_StringWalk_punctuatedJapanese_characters(_ N: Int) {
for _ in 1...charactersMultiplier*N { for _ in 1...charactersMultiplier*N {
@@ -801,8 +1174,6 @@ public func run_StringWalk_punctuatedJapanese_characters_Backwards(_ N: Int) {
} }
let punctuatedJapaneseCharacters = Array(punctuatedJapanese) let punctuatedJapaneseCharacters = Array(punctuatedJapanese)
@inline(never) @inline(never)

View File

@@ -89,8 +89,44 @@ let baseMultiplier = 10_000
let unicodeScalarsMultiplier = baseMultiplier let unicodeScalarsMultiplier = baseMultiplier
let charactersMultiplier = baseMultiplier / 5 let charactersMultiplier = baseMultiplier / 5
% for Name in ["ascii", "utf16", "tweet", "japanese", "chinese", "korean", "russian", "punctuated", "punctuatedJapanese"]: % Names = ["ascii", "utf16", "tweet", "japanese", "chinese", "korean", "russian", "punctuated", "punctuatedJapanese"]
% for Kind in ["unicodeScalars", "characters"]: % Kinds = ["unicodeScalars", "characters"]
% Directions = ["", "_Backwards"]
// An extended benchmark suite exercising finer-granularity behavior of our
// Strings.
public var StringWalk = [
BenchmarkInfo(
name: "StringWalk",
runFunction: run_StringWalk,
tags: [.validation, .api, .String]),
% for Name in Names:
% for Direction in Directions:
% for Kind in Kinds:
BenchmarkInfo(
name: "StringWalk_${Name}_${Kind}${Direction}",
runFunction: run_StringWalk_${Name}_${Kind}${Direction},
tags: [.api, .String, .skip]),
% end # Kinds
BenchmarkInfo(
name: "CharIteration_${Name}_unicodeScalars${Direction}",
runFunction: run_CharIteration_${Name}_unicodeScalars${Direction},
tags: [.validation, .api, .String]),
BenchmarkInfo(
name: "CharIndexing_${Name}_unicodeScalars${Direction}",
runFunction: run_CharIndexing_${Name}_unicodeScalars${Direction},
tags: [.validation, .api, .String]),
% end # Directions
% end # Names
]
% for Name in Names:
% for Kind in Kinds:
@inline(never) @inline(never)
public func run_StringWalk_${Name}_${Kind}(_ N: Int) { public func run_StringWalk_${Name}_${Kind}(_ N: Int) {
@@ -106,8 +142,6 @@ public func run_StringWalk_${Name}_${Kind}_Backwards(_ N: Int) {
} }
} }
% end % end
let ${Name}Characters = Array(${Name}) let ${Name}Characters = Array(${Name})

View File

@@ -12,6 +12,22 @@
import TestsUtils import TestsUtils
public let SubstringTest = [
BenchmarkInfo(name: "EqualStringSubstring", runFunction: run_EqualStringSubstring, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "EqualSubstringString", runFunction: run_EqualSubstringString, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "EqualSubstringSubstring", runFunction: run_EqualSubstringSubstring, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "EqualSubstringSubstringGenericEquatable", runFunction: run_EqualSubstringSubstringGenericEquatable, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "LessSubstringSubstring", runFunction: run_LessSubstringSubstring, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "LessSubstringSubstringGenericComparable", runFunction: run_LessSubstringSubstringGenericComparable, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "StringFromLongWholeSubstring", runFunction: run_StringFromLongWholeSubstring, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "StringFromLongWholeSubstringGeneric", runFunction: run_StringFromLongWholeSubstringGeneric, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "SubstringComparable", runFunction: run_SubstringComparable, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "SubstringEqualString", runFunction: run_SubstringEqualString, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "SubstringEquatable", runFunction: run_SubstringEquatable, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "SubstringFromLongString", runFunction: run_SubstringFromLongString, tags: [.validation, .api, .String]),
BenchmarkInfo(name: "SubstringFromLongStringGeneric", runFunction: run_SubstringFromLongStringGeneric, tags: [.validation, .api, .String]),
]
// A string that doesn't fit in small string storage and doesn't fit in Latin-1 // A string that doesn't fit in small string storage and doesn't fit in Latin-1
let longWide = "fὢasὢodὢijὢadὢolὢsjὢalὢsdὢjlὢasὢdfὢijὢliὢsdὢjøὢslὢdiὢalὢiὢ" let longWide = "fὢasὢodὢijὢadὢolὢsjὢalὢsdὢjlὢasὢdfὢijὢliὢsdὢjøὢslὢdiὢalὢiὢ"

View File

@@ -22,6 +22,65 @@ let sequenceCount = 4096
let suffixCount = 1024 let suffixCount = 1024
let sumCount = suffixCount * (2 * sequenceCount - suffixCount - 1) / 2 let sumCount = suffixCount * (2 * sequenceCount - suffixCount - 1) / 2
public let Suffix = [
BenchmarkInfo(
name: "SuffixCountableRange",
runFunction: run_SuffixCountableRange,
tags: [.validation, .api]),
BenchmarkInfo(
name: "SuffixSequence",
runFunction: run_SuffixSequence,
tags: [.validation, .api]),
BenchmarkInfo(
name: "SuffixAnySequence",
runFunction: run_SuffixAnySequence,
tags: [.validation, .api]),
BenchmarkInfo(
name: "SuffixAnySeqCntRange",
runFunction: run_SuffixAnySeqCntRange,
tags: [.validation, .api]),
BenchmarkInfo(
name: "SuffixAnySeqCRangeIter",
runFunction: run_SuffixAnySeqCRangeIter,
tags: [.validation, .api]),
BenchmarkInfo(
name: "SuffixAnyCollection",
runFunction: run_SuffixAnyCollection,
tags: [.validation, .api]),
BenchmarkInfo(
name: "SuffixArray",
runFunction: run_SuffixArray,
tags: [.validation, .api, .Array]),
BenchmarkInfo(
name: "SuffixCountableRangeLazy",
runFunction: run_SuffixCountableRangeLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "SuffixSequenceLazy",
runFunction: run_SuffixSequenceLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "SuffixAnySequenceLazy",
runFunction: run_SuffixAnySequenceLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "SuffixAnySeqCntRangeLazy",
runFunction: run_SuffixAnySeqCntRangeLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "SuffixAnySeqCRangeIterLazy",
runFunction: run_SuffixAnySeqCRangeIterLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "SuffixAnyCollectionLazy",
runFunction: run_SuffixAnyCollectionLazy,
tags: [.validation, .api]),
BenchmarkInfo(
name: "SuffixArrayLazy",
runFunction: run_SuffixArrayLazy,
tags: [.validation, .api]),
]
@inline(never) @inline(never)
public func run_SuffixCountableRange(_ N: Int) { public func run_SuffixCountableRange(_ N: Int) {
let s = 0..<sequenceCount let s = 0..<sequenceCount

View File

@@ -41,6 +41,15 @@ def lazy ((Name, Expr)) : return (Name + 'Lazy', '(' + Expr + ').lazy')
Sequences = Sequences + map(lazy, Sequences) Sequences = Sequences + map(lazy, Sequences)
}% }%
public let Suffix = [
% for (Name, Expr) in Sequences:
BenchmarkInfo(
name: "Suffix${Name}",
runFunction: run_Suffix${Name},
tags: [.validation, .api${', .Array' if Name == 'Array' else ''}]),
% end
]
% for (Name, Expr) in Sequences: % for (Name, Expr) in Sequences:
@inline(never) @inline(never)
public func run_Suffix${Name}(_ N: Int) { public func run_Suffix${Name}(_ N: Int) {

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