@@ -27,57 +27,50 @@ public let benchmarks = [
27
27
tags: [ . validation, . api, . String] )
28
28
]
29
29
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
-
36
30
@inline ( never)
37
31
public func run_singleAsciiCharacterCount100( N: Int ) {
32
+ let string = getString ( " x " )
38
33
for _ in 1 ... 5000 * N {
39
- blackHole ( repeating ( " x " , count: 100 ) )
34
+ blackHole ( String ( repeating : string , count: 100 ) )
40
35
}
41
36
}
42
37
43
38
@inline ( never)
44
39
public func run_26AsciiCharactersCount2( N: Int ) {
40
+ let string = getString ( " abcdefghijklmnopqrstuvwxyz " )
45
41
for _ in 1 ... 5000 * N {
46
- blackHole ( repeating ( " abcdefghijklmnopqrstuvwxyz " , count: 2 ) )
42
+ blackHole ( String ( repeating : string , count: 2 ) )
47
43
}
48
44
}
49
45
50
46
@inline ( never)
51
47
public func run_33CyrillicCharactersCount2( N: Int ) {
48
+ let string = getString ( " абвгґдеєжзиіїйклмнопрстуфхцчшщьюя " )
52
49
for _ in 1 ... 5000 * N {
53
- blackHole ( repeating ( " абвгґдеєжзиіїйклмнопрстуфхцчшщьюя " , count: 2 ) )
50
+ blackHole ( String ( repeating : string , count: 2 ) )
54
51
}
55
52
}
56
53
57
54
@inline ( never)
58
55
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
+ """
59
73
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 ) )
82
75
}
83
76
}
0 commit comments