Skip to content

Commit 256f609

Browse files
committed
[benchmark] StringHas[Prefix,Suffix] Legacy Factor
1 parent 9063c1e commit 256f609

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

benchmark/single-source/StringTests.swift

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,30 @@
1212
import TestsUtils
1313

1414
public let StringTests = [
15-
BenchmarkInfo(name: "StringEqualPointerComparison", runFunction: run_StringEqualPointerComparison, tags: [.validation, .api, .String]),
16-
BenchmarkInfo(name: "StringHasPrefixAscii", runFunction: run_StringHasPrefixAscii, tags: [.validation, .api, .String]),
17-
BenchmarkInfo(name: "StringHasPrefixUnicode", runFunction: run_StringHasPrefixUnicode, tags: [.validation, .api, .String]),
18-
BenchmarkInfo(name: "StringHasSuffixAscii", runFunction: run_StringHasSuffixAscii, tags: [.validation, .api, .String]),
19-
BenchmarkInfo(name: "StringHasSuffixUnicode", runFunction: run_StringHasSuffixUnicode, tags: [.validation, .api, .String]),
15+
BenchmarkInfo(
16+
name: "StringEqualPointerComparison",
17+
runFunction: run_StringEqualPointerComparison,
18+
tags: [.validation, .api, .String]),
19+
BenchmarkInfo(
20+
name: "StringHasPrefixAscii",
21+
runFunction: run_StringHasPrefixAscii,
22+
tags: [.validation, .api, .String],
23+
legacyFactor: 10),
24+
BenchmarkInfo(
25+
name: "StringHasPrefixUnicode",
26+
runFunction: run_StringHasPrefixUnicode,
27+
tags: [.validation, .api, .String],
28+
legacyFactor: 1000),
29+
BenchmarkInfo(
30+
name: "StringHasSuffixAscii",
31+
runFunction: run_StringHasSuffixAscii,
32+
tags: [.validation, .api, .String],
33+
legacyFactor: 10),
34+
BenchmarkInfo(
35+
name: "StringHasSuffixUnicode",
36+
runFunction: run_StringHasSuffixUnicode,
37+
tags: [.validation, .api, .String],
38+
legacyFactor: 1000),
2039
]
2140

2241
// FIXME(string)
@@ -25,7 +44,7 @@ public func run_StringHasPrefixAscii(_ N: Int) {
2544
let prefix = "prefix"
2645
let testString = "prefixedString"
2746
for _ in 0 ..< N {
28-
for _ in 0 ..< 100_000 {
47+
for _ in 0 ..< 10_000 {
2948
CheckResults(testString.hasPrefix(getString(prefix)))
3049
}
3150
}
@@ -38,7 +57,7 @@ public func run_StringHasSuffixAscii(_ N: Int) {
3857
let suffix = "Suffixed"
3958
let testString = "StringSuffixed"
4059
for _ in 0 ..< N {
41-
for _ in 0 ..< 100_000 {
60+
for _ in 0 ..< 10_000 {
4261
CheckResults(testString.hasSuffix(getString(suffix)))
4362
}
4463
}
@@ -51,7 +70,7 @@ public func run_StringHasPrefixUnicode(_ N: Int) {
5170
let prefix = "❄️prefix"
5271
let testString = "❄️prefixedString"
5372
for _ in 0 ..< N {
54-
for _ in 0 ..< 100_000 {
73+
for _ in 0 ..< 100 {
5574
CheckResults(testString.hasPrefix(getString(prefix)))
5675
}
5776
}
@@ -64,7 +83,7 @@ public func run_StringHasSuffixUnicode(_ N: Int) {
6483
let suffix = "❄️Suffixed"
6584
let testString = "String❄️Suffixed"
6685
for _ in 0 ..< N {
67-
for _ in 0 ..< 100_000 {
86+
for _ in 0 ..< 100 {
6887
CheckResults(testString.hasSuffix(getString(suffix)))
6988
}
7089
}

0 commit comments

Comments
 (0)