Skip to content

[benchmark] Compile and run benchmarks on Linux #7928

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 1 commit into from
Mar 8, 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
4 changes: 4 additions & 0 deletions benchmark/single-source/DictionaryBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import Foundation
import TestsUtils

#if _runtime(_ObjC)
class Thing : NSObject {

required override init() {
Expand Down Expand Up @@ -50,10 +51,13 @@ class Stuff {

}
}
#endif

@inline(never)
public func run_DictionaryBridge(_ N: Int) {
#if _runtime(_ObjC)
for _ in 1...100*N {
_ = Stuff()
}
#endif
}
4 changes: 4 additions & 0 deletions benchmark/single-source/MapReduce.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public func run_MapReduceShortString(_ N: Int) {

@inline(never)
public func run_MapReduceClass(_ N: Int) {
#if _runtime(_ObjC)
let numbers = (0..<1000).map { NSDecimalNumber(value: $0) }

var c = 0
Expand All @@ -141,10 +142,12 @@ public func run_MapReduceClass(_ N: Int) {
c += mapped.reduce(0, &+)
}
CheckResults(c != 0, "IncorrectResults in MapReduce")
#endif
}

@inline(never)
public func run_MapReduceClassShort(_ N: Int) {
#if _runtime(_ObjC)
let numbers = (0..<10).map { NSDecimalNumber(value: $0) }

var c = 0
Expand All @@ -153,5 +156,6 @@ public func run_MapReduceClassShort(_ N: Int) {
c += mapped.reduce(0, &+)
}
CheckResults(c != 0, "IncorrectResults in MapReduce")
#endif
}

2 changes: 2 additions & 0 deletions benchmark/single-source/NSDictionaryCastToSwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import TestsUtils

@inline(never)
public func run_NSDictionaryCastToSwift(_ N: Int) {
#if _runtime(_ObjC)
let NSDict = NSDictionary()
var swiftDict = [String: NSObject]()
for _ in 1...10000*N {
Expand All @@ -31,4 +32,5 @@ public func run_NSDictionaryCastToSwift(_ N: Int) {
CheckResults(swiftDict.isEmpty,
"Incorrect result in swiftDict.isEmpty: " +
"\(swiftDict.isEmpty) != true\n")
#endif
}
2 changes: 2 additions & 0 deletions benchmark/single-source/NSStringConversion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ import TestsUtils
import Foundation

public func run_NSStringConversion(_ N: Int) {
#if _runtime(_ObjC)
let test:NSString = NSString(cString: "test", encoding: String.Encoding.ascii.rawValue)!
for _ in 1...N * 10000 {
_ = test as String
}
#endif
}
Loading