diff --git a/benchmark/single-source/StringRepeating.swift b/benchmark/single-source/StringRepeating.swift index 3436680c817..f7f0acfde75 100644 --- a/benchmark/single-source/StringRepeating.swift +++ b/benchmark/single-source/StringRepeating.swift @@ -27,57 +27,50 @@ public let benchmarks = [ tags: [.validation, .api, .String]) ] -@inline(never) -func repeating(_ i: String, count: Int) -> String { - let s = String(repeating: getString(i), count: count) - return s -} - @inline(never) public func run_singleAsciiCharacterCount100(N: Int) { + let string = getString("x") for _ in 1...5000*N { - blackHole(repeating("x", count: 100)) + blackHole(String(repeating: string, count: 100)) } } @inline(never) public func run_26AsciiCharactersCount2(N: Int) { + let string = getString("abcdefghijklmnopqrstuvwxyz") for _ in 1...5000*N { - blackHole(repeating("abcdefghijklmnopqrstuvwxyz", count: 2)) + blackHole(String(repeating: string, count: 2)) } } @inline(never) public func run_33CyrillicCharactersCount2(N: Int) { + let string = getString("абвгґдеєжзиіїйклмнопрстуфхцчшщьюя") for _ in 1...5000*N { - blackHole(repeating("абвгґдеєжзиіїйклмнопрстуфхцчшщьюя", count: 2)) + blackHole(String(repeating: string, count: 2)) } } @inline(never) public func run_longMixedStringCount100(N: Int) { + let string = """ + Swift is a multi-paradigm, compiled programming language created for + iOS, OS X, watchOS, tvOS and Linux development by Apple Inc. Swift is + designed to work with Apple's Cocoa and Cocoa Touch frameworks and the + large body of existing Objective-C code written for Apple products. Swift + is intended to be more resilient to erroneous code (\"safer\") than + Objective-C and also more concise. It is built with the LLVM compiler + framework included in Xcode 6 and later and uses the Objective-C runtime, + which allows C, Objective-C, C++ and Swift code to run within a single + program. + Існує багато варіацій уривків з Lorem Ipsum, але більшість з них зазнала + певних змін на кшталт жартівливих вставок або змішування слів, які навіть + не виглядають правдоподібно. + 日本語の場合はランダムに生成された文章以外に、 + 著作権が切れた小説などが利用されることもある。 + 🦩 + """ for _ in 1...5000*N { - blackHole( - repeating( - """ - Swift is a multi-paradigm, compiled programming language created for - iOS, OS X, watchOS, tvOS and Linux development by Apple Inc. Swift is - designed to work with Apple's Cocoa and Cocoa Touch frameworks and the - large body of existing Objective-C code written for Apple products. Swift - is intended to be more resilient to erroneous code (\"safer\") than - Objective-C and also more concise. It is built with the LLVM compiler - framework included in Xcode 6 and later and uses the Objective-C runtime, - which allows C, Objective-C, C++ and Swift code to run within a single - program. - Існує багато варіацій уривків з Lorem Ipsum, але більшість з них зазнала - певних змін на кшталт жартівливих вставок або змішування слів, які навіть - не виглядають правдоподібно. - 日本語の場合はランダムに生成された文章以外に、 - 著作権が切れた小説などが利用されることもある。 - 🦩 - """, - count: 100 - ) - ) + blackHole(String(repeating: string, count: 100)) } }