Skip to content

Commit ff4e8de

Browse files
committed
[benchmark] WordCount, WordSplit Legacy Factor
1 parent 1dcdacf commit ff4e8de

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

benchmark/single-source/WordCount.swift

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,43 @@ public let WordCount = [
2727
name: "WordSplitASCII",
2828
runFunction: run_WordSplitASCII,
2929
tags: [.validation, .api, .String, .algorithm, .unstable],
30-
setUpFunction: { buildWorkload() }
30+
setUpFunction: { buildWorkload() },
31+
legacyFactor: 10
3132
),
3233
BenchmarkInfo(
3334
name: "WordSplitUTF16",
3435
runFunction: run_WordSplitUTF16,
3536
tags: [.validation, .api, .String, .algorithm, .unstable],
36-
setUpFunction: { buildWorkload() }
37+
setUpFunction: { buildWorkload() },
38+
legacyFactor: 10
3739
),
3840
BenchmarkInfo(
3941
name: "WordCountUniqueASCII",
4042
runFunction: run_WordCountUniqueASCII,
4143
tags: [.validation, .api, .String, .Dictionary, .algorithm],
42-
setUpFunction: { buildWorkload() }
44+
setUpFunction: { buildWorkload() },
45+
legacyFactor: 10
4346
),
4447
BenchmarkInfo(
4548
name: "WordCountUniqueUTF16",
4649
runFunction: run_WordCountUniqueUTF16,
4750
tags: [.validation, .api, .String, .Dictionary, .algorithm],
48-
setUpFunction: { buildWorkload() }
51+
setUpFunction: { buildWorkload() },
52+
legacyFactor: 10
4953
),
5054
BenchmarkInfo(
5155
name: "WordCountHistogramASCII",
5256
runFunction: run_WordCountHistogramASCII,
5357
tags: [.validation, .api, .String, .Dictionary, .algorithm],
54-
setUpFunction: { buildWorkload() }
58+
setUpFunction: { buildWorkload() },
59+
legacyFactor: 100
5560
),
5661
BenchmarkInfo(
5762
name: "WordCountHistogramUTF16",
5863
runFunction: run_WordCountHistogramUTF16,
5964
tags: [.validation, .api, .String, .Dictionary, .algorithm],
60-
setUpFunction: { buildWorkload() }
65+
setUpFunction: { buildWorkload() },
66+
legacyFactor: 100
6167
),
6268
]
6369

@@ -201,7 +207,7 @@ struct Words: IteratorProtocol, Sequence {
201207

202208
@inline(never)
203209
public func run_WordSplitASCII(_ N: Int) {
204-
for _ in 1...10*N {
210+
for _ in 1...N {
205211
let words = Array(Words(identity(asciiText)))
206212
CheckResults(words.count == 280)
207213
blackHole(words)
@@ -210,7 +216,7 @@ public func run_WordSplitASCII(_ N: Int) {
210216

211217
@inline(never)
212218
public func run_WordSplitUTF16(_ N: Int) {
213-
for _ in 1...10*N {
219+
for _ in 1...N {
214220
let words = Array(Words(identity(utf16Text)))
215221
CheckResults(words.count == 280)
216222
blackHole(words)
@@ -222,7 +228,7 @@ let utf16Words = Array(Words(utf16Text))
222228

223229
@inline(never)
224230
public func run_WordCountUniqueASCII(_ N: Int) {
225-
for _ in 1...100*N {
231+
for _ in 1...10*N {
226232
let words = Set(identity(asciiWords))
227233
CheckResults(words.count == 168)
228234
blackHole(words)
@@ -231,7 +237,7 @@ public func run_WordCountUniqueASCII(_ N: Int) {
231237

232238
@inline(never)
233239
public func run_WordCountUniqueUTF16(_ N: Int) {
234-
for _ in 1...100*N {
240+
for _ in 1...10*N {
235241
let words = Set(identity(utf16Words))
236242
CheckResults(words.count == 168)
237243
blackHole(words)
@@ -252,7 +258,7 @@ where S.Element == String {
252258

253259
@inline(never)
254260
public func run_WordCountHistogramASCII(_ N: Int) {
255-
for _ in 1...100*N {
261+
for _ in 1...N {
256262
let words = histogram(for: identity(asciiWords))
257263
CheckResults(words.count == 168)
258264
CheckResults(words[0] == ("and", 15))
@@ -262,7 +268,7 @@ public func run_WordCountHistogramASCII(_ N: Int) {
262268

263269
@inline(never)
264270
public func run_WordCountHistogramUTF16(_ N: Int) {
265-
for _ in 1...100*N {
271+
for _ in 1...N {
266272
let words = histogram(for: identity(utf16Words))
267273
CheckResults(words.count == 168)
268274
CheckResults(words[0] == ("and", 15))

0 commit comments

Comments
 (0)