Skip to content

[benchmark] Using tags for benchmarks #12242

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions benchmark/multi-source/PrimsSplit/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

import TestsUtils

public let PrimsSplit = BenchmarkInfo(
name: "PrimsSplit",
runFunction: run_PrimsSplit,
tags: [.validation, .algorithm])

@inline(never)
public func run_PrimsSplit(_ N: Int) {
for _ in 1...5*N {
Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/Ackermann.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
// for performance measuring.
import TestsUtils

public let Ackermann = BenchmarkInfo(
name: "Ackermann",
runFunction: run_Ackermann,
tags: [.unstable, .algorithm])

func ackermann(_ M: Int, _ N : Int) -> Int {
if (M == 0) { return N + 1 }
if (N == 0) { return ackermann(M - 1, 1) }
Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/AngryPhonebook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
import TestsUtils
import Foundation

public let AngryPhonebook = BenchmarkInfo(
name: "AngryPhonebook",
runFunction: run_AngryPhonebook,
tags: [.validation, .api, .String])

var words = [
"James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph",
"Charles", "Thomas", "Christopher", "Daniel", "Matthew", "Donald", "Anthony",
Expand Down
7 changes: 7 additions & 0 deletions benchmark/single-source/Array2D.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
//
//===----------------------------------------------------------------------===//

import TestsUtils

public let Array2D = BenchmarkInfo(
name: "Array2D",
runFunction: run_Array2D,
tags: [.validation, .api, .Array])

@inline(never)
public func run_Array2D(_ N: Int) {
var A: [[Int]] = []
Expand Down
22 changes: 22 additions & 0 deletions benchmark/single-source/ArrayAppend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,28 @@

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
@inline(never)
public func run_ArrayAppend(_ N: Int) {
Expand Down
6 changes: 6 additions & 0 deletions benchmark/single-source/ArrayInClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
//
//===----------------------------------------------------------------------===//

import TestsUtils
public let ArrayInClass = BenchmarkInfo(
name: "ArrayInClass",
runFunction: run_ArrayInClass,
tags: [.validation, .api, .Array])

class ArrayContainer {
final var arr : [Int]

Expand Down
8 changes: 8 additions & 0 deletions benchmark/single-source/ArrayLiteral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
// It is reported to be slow: <rdar://problem/17297449>
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)
func makeArray() -> [Int] {
return [1,2,3]
Expand Down
7 changes: 7 additions & 0 deletions benchmark/single-source/ArrayOfGenericPOD.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
// For comparison, we always create three arrays of 200,000 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> {
var array: [T]

Expand Down
7 changes: 7 additions & 0 deletions benchmark/single-source/ArrayOfGenericRef.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
//
// 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 {
associatedtype Element
init(e:Element)
Expand Down
7 changes: 7 additions & 0 deletions benchmark/single-source/ArrayOfPOD.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
//
// 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> {
var array : [T]

Expand Down
7 changes: 7 additions & 0 deletions benchmark/single-source/ArrayOfRef.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
//
// 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 {
associatedtype Element
init(e:Element)
Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/ArraySubscript.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
// This test checks the performance of modifying an array element.
import TestsUtils

public let ArraySubscript = BenchmarkInfo(
name: "ArraySubscript",
runFunction: run_ArraySubscript,
tags: [.validation, .api, .Array])

@inline(never)
public func run_ArraySubscript(_ N: Int) {
SRand()
Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/BitCount.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
import Foundation
import TestsUtils

public let BitCount = BenchmarkInfo(
name: "BitCount",
runFunction: run_BitCount,
tags: [.validation, .algorithm])

func countBitSet(_ num: Int) -> Int {
let bits = MemoryLayout<Int>.size * 8
var cnt: Int = 0
Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/ByteSwap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
import Foundation
import TestsUtils

public let ByteSwap = BenchmarkInfo(
name: "ByteSwap",
runFunction: run_ByteSwap,
tags: [.validation, .algorithm])

// a naive O(n) implementation of byteswap.
@inline(never)
func byteswap_n(_ a: UInt64) -> UInt64 {
Expand Down
7 changes: 7 additions & 0 deletions benchmark/single-source/CString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ import Glibc
import Darwin
#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 japanese = "日本語(にほんご、にっぽんご)は、主に日本国内や日本人同士の間で使われている言語である。"

Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/Calculator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
import TestsUtils
import Foundation

public let Calculator = BenchmarkInfo(
name: "Calculator",
runFunction: run_Calculator,
tags: [.validation])

@inline(never)
func my_atoi_impl(_ input : String) -> Int {
switch input {
Expand Down
7 changes: 7 additions & 0 deletions benchmark/single-source/CaptureProp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
return x + y
}
Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/CharacterLiteralsLarge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
// and retain a StringBuffer.
import TestsUtils

public let CharacterLiteralsLarge = BenchmarkInfo(
name: "CharacterLiteralsLarge",
runFunction: run_CharacterLiteralsLarge,
tags: [.validation, .api, .String])

@inline(never)
func makeCharacter_UTF8Length9() -> Character {
return "a\u{0300}\u{0301}\u{0302}\u{0303}"
Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/CharacterLiteralsSmall.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
// represented as a packed integer.
import TestsUtils

public let CharacterLiteralsSmall = BenchmarkInfo(
name: "CharacterLiteralsSmall",
runFunction: run_CharacterLiteralsSmall,
tags: [.validation, .api, .String])

@inline(never)
func makeCharacter_UTF8Length1() -> Character {
return "a"
Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/Chars.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
// This test tests the performance of ASCII Character comparison.
import TestsUtils

public let Chars = BenchmarkInfo(
name: "Chars",
runFunction: run_Chars,
tags: [.validation, .api, .String])

@inline(never)
public func run_Chars(_ N: Int) {
// Permute some characters.
Expand Down
7 changes: 7 additions & 0 deletions benchmark/single-source/ClassArrayGetter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
//
//===----------------------------------------------------------------------===//

import TestsUtils

public let ClassArrayGetter = BenchmarkInfo(
name: "ClassArrayGetter",
runFunction: run_ClassArrayGetter,
tags: [.validation, .api, .Array])

class Box {
var v: Int
init(v: Int) { self.v = v }
Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/DeadArray.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
// rdar://problem/20980377
import TestsUtils

public let DeadArray = BenchmarkInfo(
name: "DeadArray",
runFunction: run_DeadArray,
tags: [.regression])

@inline(__always)
func debug(_ m:String) {}

Expand Down
6 changes: 6 additions & 0 deletions benchmark/single-source/DictTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@

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)
public func run_Dictionary(scale: Int) {
let Input = [
Expand Down
6 changes: 6 additions & 0 deletions benchmark/single-source/DictTest2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

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)
public func run_Dictionary2(_ N: Int) {
let size = 500
Expand Down Expand Up @@ -55,6 +60,7 @@ class Box<T : Hashable> : Hashable {

@inline(never)
public func run_Dictionary2OfObjects(_ N: Int) {

let size = 500
let ref_result = 199
var res = 0
Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/DictTest3.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

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)
public func run_Dictionary3(_ N: Int) {
let size1 = 100
Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/DictionaryBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
import Foundation
import TestsUtils

public let DictionaryBridge = BenchmarkInfo(
name: "DictionaryBridge",
runFunction: run_DictionaryBridge,
tags: [.validation, .api, .Dictionary, .bridging])

#if _runtime(_ObjC)
class Thing : NSObject {

Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/DictionaryGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

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 result = count / 10

Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/DictionaryLiteral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
// rdar://problem/19804127
import TestsUtils

public let DictionaryLiteral = BenchmarkInfo(
name: "DictionaryLiteral",
runFunction: run_DictionaryLiteral,
tags: [.validation, .api, .Dictionary])

@inline(never)
func makeDictionary() -> [Int: Int] {
return [1: 3, 2: 2, 3: 1]
Expand Down
5 changes: 5 additions & 0 deletions benchmark/single-source/DictionaryRemove.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
// rdar://problem/19804127
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)
public func run_DictionaryRemove(_ N: Int) {
let size = 100
Expand Down
Loading