Skip to content

[benchmark] Janitor Duty: Troublemaker Legacy #22508

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 8 commits into from
Feb 11, 2019
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
10 changes: 5 additions & 5 deletions benchmark/single-source/Fibonacci.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import TestsUtils
public let Fibonacci = BenchmarkInfo(
name: "Fibonacci",
runFunction: run_Fibonacci,
tags: [.unstable, .algorithm])
tags: [.algorithm])

func fibonacci(_ n: Int) -> Int {
if (n < 2) { return 1 }
if (n <= 2) { return 1 }
return fibonacci(n - 2) + fibonacci(n - 1)
}

Expand All @@ -28,14 +28,14 @@ func Fibonacci(_ n: Int) -> Int {
// at compile time.
if False() { return 0 }

if (n < 2) { return 1 }
if (n <= 2) { return 1 }
return fibonacci(n - 2) + fibonacci(n - 1)
}

@inline(never)
public func run_Fibonacci(_ N: Int) {
let n = 32
let ref_result = 3524578
let n = 24
let ref_result = 46368
var result = 0
for _ in 1...N {
result = Fibonacci(n)
Expand Down
46 changes: 27 additions & 19 deletions benchmark/single-source/FloatingPointPrinting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,56 @@ public let FloatingPointPrinting = [
BenchmarkInfo(
name: "FloatingPointPrinting_Float_description_small",
runFunction: run_FloatingPointPrinting_Float_description_small,
tags: [.validation, .api, .runtime, .String]),
tags: [.validation, .api, .runtime, .String],
legacyFactor: 108),

BenchmarkInfo(
name: "FloatingPointPrinting_Double_description_small",
runFunction: run_FloatingPointPrinting_Double_description_small,
tags: [.validation, .api, .runtime, .String]),
tags: [.validation, .api, .runtime, .String],
legacyFactor: 100),

BenchmarkInfo(
name: "FloatingPointPrinting_Float80_description_small",
runFunction: run_FloatingPointPrinting_Float80_description_small,
tags: [.validation, .api, .runtime, .String]),
tags: [.validation, .api, .runtime, .String],
legacyFactor: 108),

BenchmarkInfo(
name: "FloatingPointPrinting_Float_description_uniform",
runFunction: run_FloatingPointPrinting_Float_description_uniform,
tags: [.validation, .api, .runtime, .String]),
tags: [.validation, .api, .runtime, .String],
legacyFactor: 100),

BenchmarkInfo(
name: "FloatingPointPrinting_Double_description_uniform",
runFunction: run_FloatingPointPrinting_Double_description_uniform,
tags: [.validation, .api, .runtime, .String]),
tags: [.validation, .api, .runtime, .String],
legacyFactor: 100),

BenchmarkInfo(
name: "FloatingPointPrinting_Float80_description_uniform",
runFunction: run_FloatingPointPrinting_Float80_description_uniform,
tags: [.validation, .api, .runtime, .String]),
tags: [.validation, .api, .runtime, .String],
legacyFactor: 100),

BenchmarkInfo(
name: "FloatingPointPrinting_Float_interpolated",
runFunction: run_FloatingPointPrinting_Float_interpolated,
tags: [.validation, .api, .runtime, .String]),
tags: [.validation, .api, .runtime, .String],
legacyFactor: 200),

BenchmarkInfo(
name: "FloatingPointPrinting_Double_interpolated",
runFunction: run_FloatingPointPrinting_Double_interpolated,
tags: [.validation, .api, .runtime, .String]),
tags: [.validation, .api, .runtime, .String],
legacyFactor: 200),

BenchmarkInfo(
name: "FloatingPointPrinting_Float80_interpolated",
runFunction: run_FloatingPointPrinting_Float80_interpolated,
tags: [.validation, .api, .runtime, .String])
tags: [.validation, .api, .runtime, .String],
legacyFactor: 200)
]

// Generate descriptions for 100,000 values around 1.0.
Expand All @@ -75,7 +84,7 @@ public let FloatingPointPrinting = [

@inline(never)
public func run_FloatingPointPrinting_Float_description_small(_ N: Int) {
let count = 100_000
let count = 1_000
for _ in 0..<N {
for i in 1...count {
let f = Float(i) / 101.0
Expand All @@ -86,7 +95,7 @@ public func run_FloatingPointPrinting_Float_description_small(_ N: Int) {

@inline(never)
public func run_FloatingPointPrinting_Double_description_small(_ N: Int) {
let count = 100_000
let count = 1_000
for _ in 0..<N {
for i in 1...count {
let f = Double(i) / 101.0
Expand All @@ -101,7 +110,7 @@ public func run_FloatingPointPrinting_Float80_description_small(_ N: Int) {
// On Darwin, long double is Float80 on x86, and Double otherwise.
// On Linux, Float80 is at aleast available on x86.
#if arch(x86_64) || arch(i386)
let count = 100_000
let count = 1_000
for _ in 0..<N {
for i in 1...count {
let f = Float80(i) / 101.0
Expand All @@ -117,7 +126,7 @@ public func run_FloatingPointPrinting_Float80_description_small(_ N: Int) {

@inline(never)
public func run_FloatingPointPrinting_Float_description_uniform(_ N: Int) {
let count = 100_000
let count = 1_000
let step = UInt32.max / UInt32(count)
for _ in 0..<N {
for i in 0..<count {
Expand All @@ -130,7 +139,7 @@ public func run_FloatingPointPrinting_Float_description_uniform(_ N: Int) {

@inline(never)
public func run_FloatingPointPrinting_Double_description_uniform(_ N: Int) {
let count = 100_000
let count = 1_000
let step = UInt64.max / UInt64(count)
for _ in 0..<N {
for i in 0..<count {
Expand All @@ -147,7 +156,7 @@ public func run_FloatingPointPrinting_Float80_description_uniform(_ N: Int) {
// On Darwin, long double is Float80 on x86, and Double otherwise.
// On Linux, Float80 is at aleast available on x86.
#if arch(x86_64) || arch(i386)
let count = 100_000
let count = 1_000
let step = UInt64.max / UInt64(count)
for _ in 0..<N {
for i in 0..<count {
Expand All @@ -167,7 +176,7 @@ public func run_FloatingPointPrinting_Float80_description_uniform(_ N: Int) {

@inline(never)
public func run_FloatingPointPrinting_Float_interpolated(_ N: Int) {
let count = 100_000
let count = 500
let step = UInt32.max / UInt32(count)
for _ in 0..<N {
for i in 0..<count {
Expand All @@ -180,7 +189,7 @@ public func run_FloatingPointPrinting_Float_interpolated(_ N: Int) {

@inline(never)
public func run_FloatingPointPrinting_Double_interpolated(_ N: Int) {
let count = 100_000
let count = 500
let step = UInt64.max / UInt64(count)
for _ in 0..<N {
for i in 0..<count {
Expand All @@ -197,7 +206,7 @@ public func run_FloatingPointPrinting_Float80_interpolated(_ N: Int) {
// On Darwin, long double is Float80 on x86, and Double otherwise.
// On Linux, Float80 is at aleast available on x86.
#if arch(x86_64) || arch(i386)
let count = 100_000
let count = 500
let step = UInt64.max / UInt64(count)
for _ in 0..<N {
for i in 0..<count {
Expand All @@ -210,4 +219,3 @@ public func run_FloatingPointPrinting_Float80_interpolated(_ N: Int) {
#endif // x86
#endif // Darwin/Linux
}

Loading