Skip to content

Commit 9bfe208

Browse files
committed
[benchmark] Fibonacci: fixed, resized & re-enabled
1 parent f1fff00 commit 9bfe208

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

benchmark/single-source/Fibonacci.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import TestsUtils
1515
public let Fibonacci = BenchmarkInfo(
1616
name: "Fibonacci",
1717
runFunction: run_Fibonacci,
18-
tags: [.unstable, .algorithm])
18+
tags: [.algorithm])
1919

2020
func fibonacci(_ n: Int) -> Int {
21-
if (n < 2) { return 1 }
21+
if (n <= 2) { return 1 }
2222
return fibonacci(n - 2) + fibonacci(n - 1)
2323
}
2424

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

31-
if (n < 2) { return 1 }
31+
if (n <= 2) { return 1 }
3232
return fibonacci(n - 2) + fibonacci(n - 1)
3333
}
3434

3535
@inline(never)
3636
public func run_Fibonacci(_ N: Int) {
37-
let n = 32
38-
let ref_result = 3524578
37+
let n = 24
38+
let ref_result = 46368
3939
var result = 0
4040
for _ in 1...N {
4141
result = Fibonacci(n)

0 commit comments

Comments
 (0)