mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[benchmark] Don't create array instance in modules with solitary benchmarks
It just produces unnecessary code sign churn.
This commit is contained in:
@@ -14,12 +14,11 @@
|
||||
// for performance measuring.
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Ackermann",
|
||||
runFunction: run_Ackermann,
|
||||
tags: [.algorithm]),
|
||||
]
|
||||
tags: [.algorithm])
|
||||
|
||||
func _ackermann(_ m: Int, _ n : Int) -> Int {
|
||||
if (m == 0) { return n + 1 }
|
||||
|
||||
@@ -22,14 +22,13 @@ import TestsUtils
|
||||
// 11% _swift_stdlib_makeAnyHashableUpcastingToHashableBaseType
|
||||
// 16% _swift_retain_[n]
|
||||
// 5% swift_conformsToProtocol
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "AnyHashableWithAClass",
|
||||
runFunction: run_AnyHashableWithAClass,
|
||||
tags: [.abstraction, .runtime, .cpubench],
|
||||
legacyFactor: 500
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
class TestHashableBase : Hashable {
|
||||
var value: Int
|
||||
|
||||
@@ -12,15 +12,14 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Array2D",
|
||||
runFunction: run_Array2D,
|
||||
tags: [.validation, .api, .Array],
|
||||
setUpFunction: { blackHole(inputArray) },
|
||||
tearDownFunction: { inputArray = nil },
|
||||
legacyFactor: 16),
|
||||
]
|
||||
legacyFactor: 16)
|
||||
|
||||
let size = 256
|
||||
|
||||
|
||||
@@ -17,13 +17,12 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ArrayOfGenericRef",
|
||||
runFunction: run_ArrayOfGenericRef,
|
||||
tags: [.validation, .api, .Array],
|
||||
legacyFactor: 10)
|
||||
]
|
||||
|
||||
protocol Constructible {
|
||||
associatedtype Element
|
||||
|
||||
@@ -18,12 +18,11 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ArrayOfPOD",
|
||||
runFunction: run_ArrayOfPOD,
|
||||
tags: [.validation, .api, .Array])
|
||||
]
|
||||
|
||||
class RefArray<T> {
|
||||
var array : [T]
|
||||
|
||||
@@ -18,13 +18,12 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ArrayOfRef",
|
||||
runFunction: run_ArrayOfRef,
|
||||
tags: [.validation, .api, .Array],
|
||||
legacyFactor: 10)
|
||||
]
|
||||
|
||||
protocol Constructible {
|
||||
associatedtype Element
|
||||
|
||||
@@ -15,13 +15,12 @@ import TestsUtils
|
||||
// 33% isUniquelyReferenced
|
||||
// 15% swift_rt_swift_isUniquelyReferencedOrPinned_nonNull_native
|
||||
// 18% swift_isUniquelyReferencedOrPinned_nonNull_native
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ArraySetElement",
|
||||
runFunction: run_ArraySetElement,
|
||||
tags: [.runtime, .cpubench]
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
// This is an effort to defeat isUniquelyReferenced optimization. Ideally
|
||||
// microbenchmarks list this should be written in C.
|
||||
|
||||
@@ -13,13 +13,12 @@
|
||||
// This test checks the performance of modifying an array element.
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ArraySubscript",
|
||||
runFunction: run_ArraySubscript,
|
||||
tags: [.validation, .api, .Array],
|
||||
legacyFactor: 4),
|
||||
]
|
||||
legacyFactor: 4)
|
||||
|
||||
@inline(never)
|
||||
public func run_ArraySubscript(_ n: Int) {
|
||||
|
||||
@@ -15,12 +15,11 @@
|
||||
// rdar://problem/22151678
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "BitCount",
|
||||
runFunction: run_BitCount,
|
||||
tags: [.validation, .algorithm]),
|
||||
]
|
||||
tags: [.validation, .algorithm])
|
||||
|
||||
func countBitSet(_ num: Int) -> Int {
|
||||
let bits = MemoryLayout<Int>.size * 8
|
||||
|
||||
@@ -27,14 +27,13 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "BucketSort",
|
||||
runFunction: run_BucketSort,
|
||||
tags: [.validation, .algorithm],
|
||||
setUpFunction: { blackHole(buckets) }
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
public protocol IntegerConvertible {
|
||||
func convertToInt() -> Int
|
||||
|
||||
@@ -15,12 +15,11 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ByteSwap",
|
||||
runFunction: run_ByteSwap,
|
||||
tags: [.validation, .algorithm]),
|
||||
]
|
||||
tags: [.validation, .algorithm])
|
||||
|
||||
// a naive O(n) implementation of byteswap.
|
||||
@inline(never)
|
||||
|
||||
@@ -15,14 +15,13 @@ import TestsUtils
|
||||
// This test makes sure that even though we have +0 arguments by default that we
|
||||
// can properly convert +0 -> +1 to avoid extra COW copies.
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "COWArrayGuaranteedParameterOverhead",
|
||||
runFunction: run_COWArrayGuaranteedParameterOverhead,
|
||||
tags: [.regression, .abstraction, .refcount],
|
||||
legacyFactor: 50
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
@inline(never)
|
||||
func caller() {
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Calculator",
|
||||
runFunction: run_Calculator,
|
||||
tags: [.validation])
|
||||
]
|
||||
|
||||
@inline(never)
|
||||
func my_atoi_impl(_ input : String) -> Int {
|
||||
|
||||
@@ -12,13 +12,12 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "CaptureProp",
|
||||
runFunction: run_CaptureProp,
|
||||
tags: [.validation, .api, .refcount],
|
||||
legacyFactor: 10),
|
||||
]
|
||||
legacyFactor: 10)
|
||||
|
||||
func sum(_ x:Int, y:Int) -> Int {
|
||||
return x + y
|
||||
|
||||
@@ -15,12 +15,11 @@
|
||||
// and retain a StringBuffer.
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "CharacterLiteralsLarge",
|
||||
runFunction: run_CharacterLiteralsLarge,
|
||||
tags: [.validation, .api, .String])
|
||||
]
|
||||
|
||||
@inline(never)
|
||||
func makeCharacter_UTF8Length9() -> Character {
|
||||
|
||||
@@ -15,12 +15,11 @@
|
||||
// represented as a packed integer.
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "CharacterLiteralsSmall",
|
||||
runFunction: run_CharacterLiteralsSmall,
|
||||
tags: [.validation, .api, .String]),
|
||||
]
|
||||
tags: [.validation, .api, .String])
|
||||
|
||||
@inline(never)
|
||||
func makeCharacter_UTF8Length1() -> Character {
|
||||
|
||||
@@ -13,14 +13,13 @@
|
||||
// This test tests the performance of ASCII Character comparison.
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Chars2",
|
||||
runFunction: run_Chars,
|
||||
tags: [.validation, .api, .String],
|
||||
setUpFunction: { blackHole(alphabetInput) },
|
||||
legacyFactor: 50),
|
||||
]
|
||||
legacyFactor: 50)
|
||||
|
||||
let alphabetInput: [Character] = [
|
||||
"A", "B", "C", "D", "E", "F", "G",
|
||||
|
||||
@@ -12,15 +12,14 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ClassArrayGetter2",
|
||||
runFunction: run_ClassArrayGetter,
|
||||
tags: [.validation, .api, .Array],
|
||||
setUpFunction: { blackHole(inputArray) },
|
||||
tearDownFunction: { inputArray = nil },
|
||||
legacyFactor: 10),
|
||||
]
|
||||
legacyFactor: 10)
|
||||
|
||||
class Box {
|
||||
var v: Int
|
||||
|
||||
@@ -5,13 +5,12 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Combos",
|
||||
runFunction: run_Combos,
|
||||
tags: [.validation, .abstraction]
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
@inline(never)
|
||||
public func run_Combos(_ n: Int) {
|
||||
|
||||
@@ -13,14 +13,13 @@
|
||||
// rdar://problem/20980377
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "DeadArray",
|
||||
runFunction: run_DeadArray,
|
||||
tags: [.regression, .unstable],
|
||||
legacyFactor: 200
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
@inline(__always)
|
||||
func debug(_ m:String) {}
|
||||
|
||||
@@ -16,12 +16,11 @@
|
||||
import Foundation
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "DictionaryBridge",
|
||||
runFunction: run_DictionaryBridge,
|
||||
tags: [.validation, .api, .Dictionary, .bridging]),
|
||||
]
|
||||
tags: [.validation, .api, .Dictionary, .bridging])
|
||||
|
||||
#if _runtime(_ObjC)
|
||||
class Thing : NSObject {
|
||||
|
||||
@@ -16,13 +16,12 @@ import TestsUtils
|
||||
// described in Myers (1986). The Diffing benchmark tracks the performance
|
||||
// of `Collection.difference(from:to:)`.
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Diffing.Myers.Similar",
|
||||
runFunction: run_Myers,
|
||||
tags: [.algorithm],
|
||||
setUpFunction: { blackHole((loremIpsum, unabridgedLorem)) })
|
||||
]
|
||||
|
||||
|
||||
let loremIpsum = Array("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
|
||||
|
||||
@@ -12,13 +12,12 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ErrorHandling",
|
||||
runFunction: run_ErrorHandling,
|
||||
tags: [.validation, .exceptions],
|
||||
legacyFactor: 10),
|
||||
]
|
||||
legacyFactor: 10)
|
||||
|
||||
enum PizzaError : Error {
|
||||
case Pepperoni, Olives, Anchovy
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Fibonacci",
|
||||
runFunction: run_Fibonacci,
|
||||
tags: [.algorithm])
|
||||
]
|
||||
|
||||
func _fibonacci(_ n: Int) -> Int {
|
||||
if (n <= 2) { return 1 }
|
||||
|
||||
@@ -14,13 +14,12 @@
|
||||
// <rdar://problem/22151932>
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Hanoi",
|
||||
runFunction: run_Hanoi,
|
||||
tags: [.validation, .algorithm],
|
||||
legacyFactor: 10),
|
||||
]
|
||||
legacyFactor: 10)
|
||||
|
||||
struct Move {
|
||||
var from: String
|
||||
|
||||
@@ -14,12 +14,11 @@
|
||||
// <rdar://problem/17384894>
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Histogram",
|
||||
runFunction: run_Histogram,
|
||||
tags: [.validation, .algorithm]),
|
||||
]
|
||||
tags: [.validation, .algorithm])
|
||||
|
||||
typealias rrggbb_t = UInt32
|
||||
|
||||
|
||||
@@ -15,12 +15,11 @@ import TestsUtils
|
||||
// A micro-benchmark for recursive divide and conquer problems.
|
||||
// The program performs integration via Gaussian Quadrature
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Integrate",
|
||||
runFunction: run_Integrate,
|
||||
tags: [.validation, .algorithm]),
|
||||
]
|
||||
tags: [.validation, .algorithm])
|
||||
|
||||
class Integrate {
|
||||
static let epsilon = 1.0e-9
|
||||
|
||||
@@ -13,13 +13,12 @@
|
||||
import TestsUtils
|
||||
import Foundation
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "IterateData",
|
||||
runFunction: run_IterateData,
|
||||
tags: [.validation, .api, .Data],
|
||||
setUpFunction: { blackHole(data) }),
|
||||
]
|
||||
setUpFunction: { blackHole(data) })
|
||||
|
||||
let data: Data = {
|
||||
var data = Data(count: 16 * 1024)
|
||||
|
||||
@@ -13,12 +13,11 @@
|
||||
// This test tests the performance of ASCII Character comparison.
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Join",
|
||||
runFunction: run_Join,
|
||||
tags: [.validation, .api, .String, .Array])
|
||||
]
|
||||
|
||||
@inline(never)
|
||||
public func run_Join(_ n: Int) {
|
||||
|
||||
@@ -16,15 +16,14 @@ import TestsUtils
|
||||
|
||||
// 47% _swift_retain
|
||||
// 43% _swift_release
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "LinkedList",
|
||||
runFunction: run_LinkedList,
|
||||
tags: [.runtime, .cpubench, .refcount],
|
||||
setUpFunction: { for i in 0..<size { head = Node(n:head, d:i) } },
|
||||
tearDownFunction: { head = Node(n:nil, d:0) },
|
||||
legacyFactor: 40),
|
||||
]
|
||||
legacyFactor: 40)
|
||||
|
||||
let size = 100
|
||||
var head = Node(n:nil, d:0)
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Memset",
|
||||
runFunction: run_Memset,
|
||||
tags: [.validation]),
|
||||
]
|
||||
tags: [.validation])
|
||||
|
||||
@inline(never)
|
||||
func memset(_ a: inout [Int], _ c: Int) {
|
||||
|
||||
@@ -19,13 +19,12 @@
|
||||
// Thus, e = N / Nempty.
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "MonteCarloE",
|
||||
runFunction: run_MonteCarloE,
|
||||
tags: [.validation, .algorithm],
|
||||
legacyFactor: 20),
|
||||
]
|
||||
legacyFactor: 20)
|
||||
|
||||
public func run_MonteCarloE(scale: Int) {
|
||||
var lfsr = LFSR()
|
||||
|
||||
@@ -12,13 +12,12 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "MonteCarloPi",
|
||||
runFunction: run_MonteCarloPi,
|
||||
tags: [.validation, .algorithm],
|
||||
legacyFactor: 125)
|
||||
]
|
||||
|
||||
public func run_MonteCarloPi(scale: Int) {
|
||||
var rng = LFSR()
|
||||
|
||||
@@ -18,13 +18,12 @@
|
||||
import Foundation
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "NSDictionaryCastToSwift",
|
||||
runFunction: run_NSDictionaryCastToSwift,
|
||||
tags: [.validation, .api, .Dictionary, .bridging],
|
||||
legacyFactor: 10),
|
||||
]
|
||||
legacyFactor: 10)
|
||||
|
||||
@inline(never)
|
||||
public func run_NSDictionaryCastToSwift(_ n: Int) {
|
||||
|
||||
@@ -13,13 +13,12 @@
|
||||
// <rdar://problem/17838787>
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "NopDeinit",
|
||||
runFunction: run_NopDeinit,
|
||||
tags: [.regression],
|
||||
legacyFactor: 100)
|
||||
]
|
||||
|
||||
class X<T : Comparable> {
|
||||
let deinitIters = 10000
|
||||
|
||||
@@ -16,13 +16,12 @@ import TestsUtils
|
||||
// 53% _swift_release_dealloc
|
||||
// 30% _swift_alloc_object
|
||||
// 10% retain/release
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ObjectAllocation",
|
||||
runFunction: run_ObjectAllocation,
|
||||
tags: [.runtime, .cpubench]
|
||||
)
|
||||
]
|
||||
|
||||
final class XX {
|
||||
var xx: Int
|
||||
|
||||
@@ -13,13 +13,12 @@
|
||||
import TestsUtils
|
||||
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ObserverClosure",
|
||||
runFunction: run_ObserverClosure,
|
||||
tags: [.validation],
|
||||
legacyFactor: 10)
|
||||
]
|
||||
|
||||
class Observer {
|
||||
@inline(never)
|
||||
|
||||
@@ -12,13 +12,12 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ObserverForwarderStruct",
|
||||
runFunction: run_ObserverForwarderStruct,
|
||||
tags: [.validation],
|
||||
legacyFactor: 5),
|
||||
]
|
||||
legacyFactor: 5)
|
||||
|
||||
class Observer {
|
||||
@inline(never)
|
||||
|
||||
@@ -12,13 +12,12 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ObserverPartiallyAppliedMethod",
|
||||
runFunction: run_ObserverPartiallyAppliedMethod,
|
||||
tags: [.validation],
|
||||
legacyFactor: 20)
|
||||
]
|
||||
|
||||
class Observer {
|
||||
@inline(never)
|
||||
|
||||
@@ -12,13 +12,12 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ObserverUnappliedMethod",
|
||||
runFunction: run_ObserverUnappliedMethod,
|
||||
tags: [.validation],
|
||||
legacyFactor: 10),
|
||||
]
|
||||
legacyFactor: 10)
|
||||
|
||||
class Observer {
|
||||
@inline(never)
|
||||
|
||||
@@ -12,14 +12,13 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "OpaqueConsumingUsers",
|
||||
runFunction: run_OpaqueConsumingUsers,
|
||||
tags: [.regression, .abstraction, .refcount],
|
||||
setUpFunction: setup_OpaqueConsumingUsers,
|
||||
legacyFactor: 20),
|
||||
]
|
||||
legacyFactor: 20)
|
||||
|
||||
// This test exercises the ability of the optimizer to propagate the +1 from a
|
||||
// consuming argument of a non-inlineable through multiple non-inlinable call
|
||||
|
||||
@@ -13,12 +13,11 @@
|
||||
import TestsUtils
|
||||
|
||||
// A micro benchmark for checking the speed of string-based enums.
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "OpenClose",
|
||||
runFunction: run_OpenClose,
|
||||
tags: [.validation, .api, .String]),
|
||||
]
|
||||
tags: [.validation, .api, .String])
|
||||
|
||||
enum MyState : String {
|
||||
case Closed = "Closed"
|
||||
|
||||
@@ -14,15 +14,14 @@
|
||||
// for performance measuring.
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Phonebook",
|
||||
runFunction: run_Phonebook,
|
||||
tags: [.validation, .api, .String],
|
||||
setUpFunction: { blackHole(names) },
|
||||
legacyFactor: 7
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
let words = [
|
||||
"James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph",
|
||||
|
||||
@@ -12,13 +12,12 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "PopFrontArrayGeneric",
|
||||
runFunction: run_PopFrontArrayGeneric,
|
||||
tags: [.validation, .api, .Array],
|
||||
legacyFactor: 20),
|
||||
]
|
||||
legacyFactor: 20)
|
||||
|
||||
let arrayCount = 1024
|
||||
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo (
|
||||
name: "ProtocolConformance",
|
||||
runFunction: run_ProtocolConformance,
|
||||
tags: [.validation, .runtime]),
|
||||
]
|
||||
tags: [.validation, .runtime])
|
||||
|
||||
protocol P {}
|
||||
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ProtocolDispatch",
|
||||
runFunction: run_ProtocolDispatch,
|
||||
tags: [.validation, .abstraction]),
|
||||
]
|
||||
tags: [.validation, .abstraction])
|
||||
|
||||
@inline(never)
|
||||
public func run_ProtocolDispatch(_ n: Int) {
|
||||
|
||||
@@ -16,12 +16,11 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "ProtocolDispatch2",
|
||||
runFunction: run_ProtocolDispatch2,
|
||||
tags: [.validation, .abstraction, .cpubench]),
|
||||
]
|
||||
tags: [.validation, .abstraction, .cpubench])
|
||||
|
||||
protocol Pingable { func ping() -> Int; func pong() -> Int}
|
||||
|
||||
|
||||
@@ -14,12 +14,11 @@
|
||||
// for performance measuring.
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "RC4",
|
||||
runFunction: run_RC4,
|
||||
tags: [.validation, .algorithm]),
|
||||
]
|
||||
tags: [.validation, .algorithm])
|
||||
|
||||
struct RC4 {
|
||||
var state: [UInt8]
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "RangeAssignment",
|
||||
runFunction: run_RangeAssignment,
|
||||
tags: [.validation, .api]),
|
||||
]
|
||||
tags: [.validation, .api])
|
||||
|
||||
@inline(never)
|
||||
public func run_RangeAssignment(_ scale: Int) {
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "RangeReplaceableCollectionPlusDefault",
|
||||
runFunction: run_RangeReplaceableCollectionPlusDefault,
|
||||
tags: [.validation],
|
||||
legacyFactor: 4
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
@inline(never)
|
||||
public func run_RangeReplaceableCollectionPlusDefault(_ n: Int) {
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "RecursiveOwnedParameter",
|
||||
runFunction: run_RecursiveOwnedParameter,
|
||||
tags: [.validation, .api, .Array, .refcount]),
|
||||
]
|
||||
tags: [.validation, .api, .Array, .refcount])
|
||||
|
||||
// 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
|
||||
|
||||
@@ -22,13 +22,12 @@ import Foundation
|
||||
// 7% objc_msgSend
|
||||
// 5% _swift_release_
|
||||
// 2% _swift_retain_
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "SevenBoom",
|
||||
runFunction: run_SevenBoom,
|
||||
tags: [.runtime, .exceptions, .bridging, .cpubench]
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
@inline(never)
|
||||
func filter_seven(_ input : Int) throws {
|
||||
|
||||
@@ -11,12 +11,11 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Sim2DArray",
|
||||
runFunction: run_Sim2DArray,
|
||||
tags: [.validation, .api, .Array]),
|
||||
]
|
||||
tags: [.validation, .api, .Array])
|
||||
|
||||
struct Array2D {
|
||||
var storage : [Int]
|
||||
|
||||
@@ -14,12 +14,11 @@
|
||||
// array of letters.
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "SortLettersInPlace",
|
||||
runFunction: run_SortLettersInPlace,
|
||||
tags: [.validation, .api, .algorithm, .String])
|
||||
]
|
||||
|
||||
class Letter {
|
||||
let value: String
|
||||
|
||||
@@ -11,13 +11,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "StackPromo",
|
||||
runFunction: run_StackPromo,
|
||||
tags: [.regression, .cpubench],
|
||||
legacyFactor: 100),
|
||||
]
|
||||
legacyFactor: 100)
|
||||
|
||||
protocol Proto {
|
||||
func at() -> Int
|
||||
|
||||
@@ -12,13 +12,12 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "StrComplexWalk",
|
||||
runFunction: run_StrComplexWalk,
|
||||
tags: [.validation, .api, .String],
|
||||
legacyFactor: 10),
|
||||
]
|
||||
legacyFactor: 10)
|
||||
|
||||
@inline(never)
|
||||
public func run_StrComplexWalk(_ n: Int) {
|
||||
|
||||
@@ -14,13 +14,12 @@
|
||||
// It is reported to be very slow: <rdar://problem/17255477>
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "StrToInt",
|
||||
runFunction: run_StrToInt,
|
||||
tags: [.validation, .api, .String],
|
||||
legacyFactor: 10),
|
||||
]
|
||||
legacyFactor: 10)
|
||||
|
||||
@inline(never)
|
||||
public func run_StrToInt(_ n: Int) {
|
||||
|
||||
@@ -19,13 +19,12 @@ import MSVCRT
|
||||
import Darwin
|
||||
#endif
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "StringMatch",
|
||||
runFunction: run_StringMatch,
|
||||
tags: [.validation, .api, .String],
|
||||
legacyFactor: 100),
|
||||
]
|
||||
legacyFactor: 100)
|
||||
|
||||
/* match: search for regexp anywhere in text */
|
||||
func match(regexp: String, text: String) -> Bool {
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "StringRemoveDupes",
|
||||
runFunction: run_StringRemoveDupes,
|
||||
tags: [.validation, .String]
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
@inline(never)
|
||||
public func run_StringRemoveDupes(_ n: Int) {
|
||||
|
||||
@@ -13,13 +13,12 @@
|
||||
// This test tests the performance of ASCII Character comparison.
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "SuperChars2",
|
||||
runFunction: run_SuperChars,
|
||||
tags: [.validation, .api, .String],
|
||||
setUpFunction: { blackHole(alphabetInput) }),
|
||||
]
|
||||
setUpFunction: { blackHole(alphabetInput) })
|
||||
|
||||
// Permute some characters.
|
||||
let alphabetInput: [Character] = [
|
||||
|
||||
@@ -14,13 +14,12 @@
|
||||
// Given an array and a number C, find elements A and B such that A+B = C
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "TwoSum",
|
||||
runFunction: run_TwoSum,
|
||||
tags: [.validation, .api, .Dictionary, .Array, .algorithm],
|
||||
legacyFactor: 2),
|
||||
]
|
||||
legacyFactor: 2)
|
||||
|
||||
let array = [
|
||||
959, 81, 670, 727, 416, 171, 401, 398, 707, 596, 200, 9, 414, 98, 43,
|
||||
|
||||
@@ -24,12 +24,11 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "TypeFlood",
|
||||
runFunction: run_TypeFlood,
|
||||
tags: [.validation, .metadata]),
|
||||
]
|
||||
tags: [.validation, .metadata])
|
||||
|
||||
protocol Pingable {}
|
||||
|
||||
|
||||
@@ -19,12 +19,11 @@ import MSVCRT
|
||||
import Darwin
|
||||
#endif
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "Walsh",
|
||||
runFunction: run_Walsh,
|
||||
tags: [.validation, .algorithm]),
|
||||
]
|
||||
tags: [.validation, .algorithm])
|
||||
|
||||
func isPowerOfTwo(_ x: Int) -> Bool { return (x & (x - 1)) == 0 }
|
||||
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
|
||||
import TestsUtils
|
||||
|
||||
public let benchmarks = [
|
||||
public let benchmarks =
|
||||
BenchmarkInfo(
|
||||
name: "XorLoop",
|
||||
runFunction: run_XorLoop,
|
||||
tags: [.validation])
|
||||
]
|
||||
|
||||
@inline(never)
|
||||
public func run_XorLoop(_ n: Int) {
|
||||
|
||||
@@ -61,6 +61,10 @@ struct BenchResults {
|
||||
|
||||
public var registeredBenchmarks: [BenchmarkInfo] = []
|
||||
|
||||
public func register(_ benchmark: BenchmarkInfo) {
|
||||
registeredBenchmarks.append(benchmark)
|
||||
}
|
||||
|
||||
public func register<S: Sequence>(_ benchmarks: S)
|
||||
where S.Element == BenchmarkInfo {
|
||||
registeredBenchmarks.append(contentsOf: benchmarks)
|
||||
|
||||
Reference in New Issue
Block a user