Skip to content

Commit da31b40

Browse files
committed
[benchmark] InsertCharacterStartIndex legacyFactor
1 parent d76228b commit da31b40

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

benchmark/single-source/InsertCharacter.swift

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- InsertCharacter.swift ------------------------------------------------===//
1+
//===--- InsertCharacter.swift --------------------------------------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//
@@ -12,13 +12,27 @@
1212

1313
import TestsUtils
1414

15+
let t: [BenchmarkCategory] = [.validation, .api, .String]
16+
1517
public let InsertCharacter = [
16-
BenchmarkInfo(name: "InsertCharacterEndIndex", runFunction: run_InsertCharacterEndIndex, tags: [.validation, .api], setUpFunction: buildWorkload),
17-
BenchmarkInfo(name: "InsertCharacterTowardsEndIndex", runFunction: run_InsertCharacterTowardsEndIndex, tags: [.validation, .api], setUpFunction: buildWorkload),
18-
BenchmarkInfo(name: "InsertCharacterStartIndex", runFunction: run_InsertCharacterStartIndex, tags: [.validation, .api], setUpFunction: buildWorkload),
19-
BenchmarkInfo(name: "InsertCharacterEndIndexNonASCII", runFunction: run_InsertCharacterEndIndexNonASCII, tags: [.validation, .api], setUpFunction: buildWorkload),
20-
BenchmarkInfo(name: "InsertCharacterTowardsEndIndexNonASCII", runFunction: run_InsertCharacterTowardsEndIndexNonASCII, tags: [.validation, .api], setUpFunction: buildWorkload),
21-
BenchmarkInfo(name: "InsertCharacterStartIndexNonASCII", runFunction: run_InsertCharacterStartIndexNonASCII, tags: [.validation, .api], setUpFunction: buildWorkload)
18+
BenchmarkInfo(name: "InsertCharacterEndIndex",
19+
runFunction: run_InsertCharacterEndIndex, tags: t,
20+
setUpFunction: buildWorkload),
21+
BenchmarkInfo(name: "InsertCharacterTowardsEndIndex",
22+
runFunction: run_InsertCharacterTowardsEndIndex, tags: t,
23+
setUpFunction: buildWorkload),
24+
BenchmarkInfo(name: "InsertCharacterStartIndex",
25+
runFunction: run_InsertCharacterStartIndex, tags: t,
26+
setUpFunction: buildWorkload, legacyFactor: 5),
27+
BenchmarkInfo(name: "InsertCharacterEndIndexNonASCII",
28+
runFunction: run_InsertCharacterEndIndexNonASCII, tags: t,
29+
setUpFunction: buildWorkload),
30+
BenchmarkInfo(name: "InsertCharacterTowardsEndIndexNonASCII",
31+
runFunction: run_InsertCharacterTowardsEndIndexNonASCII, tags: t,
32+
setUpFunction: buildWorkload),
33+
BenchmarkInfo(name: "InsertCharacterStartIndexNonASCII",
34+
runFunction: run_InsertCharacterStartIndexNonASCII, tags: t,
35+
setUpFunction: buildWorkload)
2236
]
2337

2438
let str = String(repeating: "A very long ASCII string.", count: 200)
@@ -76,7 +90,8 @@ func run_InsertCharacterEndIndexNonASCII(_ N: Int) {
7690
// Insert at start index
7791

7892
@inline(__always)
79-
func insertAtStartIndex(_ c: Character, in string: String, count: Int, insertions: Int) {
93+
func insertAtStartIndex(
94+
_ c: Character, in string: String, count: Int, insertions: Int) {
8095
var workload = str
8196
for _ in 0..<count {
8297
for _ in 0..<insertions {
@@ -89,7 +104,7 @@ func insertAtStartIndex(_ c: Character, in string: String, count: Int, insertion
89104

90105
@inline(never)
91106
func run_InsertCharacterStartIndex(_ N: Int) {
92-
insertAtStartIndex("w", in: str, count: N * 75, insertions: 50)
107+
insertAtStartIndex("w", in: str, count: N * 15, insertions: 50)
93108
}
94109

95110
@inline(never)

0 commit comments

Comments
 (0)