Skip to content

Commit e59a74d

Browse files
committed
Get rid of helper function
1 parent da5be81 commit e59a74d

File tree

1 file changed

+24
-31
lines changed

1 file changed

+24
-31
lines changed

benchmark/single-source/StringRepeating.swift

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,57 +27,50 @@ public let benchmarks = [
2727
tags: [.validation, .api, .String])
2828
]
2929

30-
@inline(never)
31-
func repeating(_ i: String, count: Int) -> String {
32-
let s = String(repeating: getString(i), count: count)
33-
return s
34-
}
35-
3630
@inline(never)
3731
public func run_singleAsciiCharacterCount100(N: Int) {
32+
let string = getString("x")
3833
for _ in 1...5000*N {
39-
blackHole(repeating("x", count: 100))
34+
blackHole(String(repeating: string, count: 100))
4035
}
4136
}
4237

4338
@inline(never)
4439
public func run_26AsciiCharactersCount2(N: Int) {
40+
let string = getString("abcdefghijklmnopqrstuvwxyz")
4541
for _ in 1...5000*N {
46-
blackHole(repeating("abcdefghijklmnopqrstuvwxyz", count: 2))
42+
blackHole(String(repeating: string, count: 2))
4743
}
4844
}
4945

5046
@inline(never)
5147
public func run_33CyrillicCharactersCount2(N: Int) {
48+
let string = getString("абвгґдеєжзиіїйклмнопрстуфхцчшщьюя")
5249
for _ in 1...5000*N {
53-
blackHole(repeating("абвгґдеєжзиіїйклмнопрстуфхцчшщьюя", count: 2))
50+
blackHole(String(repeating: string, count: 2))
5451
}
5552
}
5653

5754
@inline(never)
5855
public func run_longMixedStringCount100(N: Int) {
56+
let string = """
57+
Swift is a multi-paradigm, compiled programming language created for
58+
iOS, OS X, watchOS, tvOS and Linux development by Apple Inc. Swift is
59+
designed to work with Apple's Cocoa and Cocoa Touch frameworks and the
60+
large body of existing Objective-C code written for Apple products. Swift
61+
is intended to be more resilient to erroneous code (\"safer\") than
62+
Objective-C and also more concise. It is built with the LLVM compiler
63+
framework included in Xcode 6 and later and uses the Objective-C runtime,
64+
which allows C, Objective-C, C++ and Swift code to run within a single
65+
program.
66+
Існує багато варіацій уривків з Lorem Ipsum, але більшість з них зазнала
67+
певних змін на кшталт жартівливих вставок або змішування слів, які навіть
68+
не виглядають правдоподібно.
69+
日本語の場合はランダムに生成された文章以外に、
70+
著作権が切れた小説などが利用されることもある。
71+
🦩
72+
"""
5973
for _ in 1...5000*N {
60-
blackHole(
61-
repeating(
62-
"""
63-
Swift is a multi-paradigm, compiled programming language created for
64-
iOS, OS X, watchOS, tvOS and Linux development by Apple Inc. Swift is
65-
designed to work with Apple's Cocoa and Cocoa Touch frameworks and the
66-
large body of existing Objective-C code written for Apple products. Swift
67-
is intended to be more resilient to erroneous code (\"safer\") than
68-
Objective-C and also more concise. It is built with the LLVM compiler
69-
framework included in Xcode 6 and later and uses the Objective-C runtime,
70-
which allows C, Objective-C, C++ and Swift code to run within a single
71-
program.
72-
Існує багато варіацій уривків з Lorem Ipsum, але більшість з них зазнала
73-
певних змін на кшталт жартівливих вставок або змішування слів, які навіть
74-
не виглядають правдоподібно.
75-
日本語の場合はランダムに生成された文章以外に、
76-
著作権が切れた小説などが利用されることもある。
77-
🦩
78-
""",
79-
count: 100
80-
)
81-
)
74+
blackHole(String(repeating: string, count: 100))
8275
}
8376
}

0 commit comments

Comments
 (0)