Skip to content

Commit 460cd35

Browse files
rctcwyvrnmilseman
authored andcommitted
Remove redundant string inits
1 parent 10ec769 commit 460cd35

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Sources/RegexBenchmark/Suite/ReluctantQuant.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import RegexBuilder
44
extension BenchmarkRunner {
55
mutating func addReluctantQuant() {
66
let size = 500000
7+
let s = String(repeating: "a", count: size)
78

89
let reluctantQuant = Benchmark(
910
name: "ReluctantQuant",
1011
regex: Regex {
1112
OneOrMore(.any, .reluctant)
1213
},
1314
ty: .whole,
14-
target: String(repeating: "a", count: size)
15+
target: s
1516
)
1617

1718
let eagarQuantWithTerminal = Benchmark(
@@ -21,7 +22,7 @@ extension BenchmarkRunner {
2122
";"
2223
},
2324
ty: .whole,
24-
target: String(repeating: "a", count: size) + ";"
25+
target: s + ";"
2526
)
2627

2728
let reluctantQuantWithTerminal = Benchmark(
@@ -31,7 +32,7 @@ extension BenchmarkRunner {
3132
";"
3233
},
3334
ty: .whole,
34-
target: String(repeating: "a", count: size) + ";"
35+
target: s + ";"
3536
)
3637

3738
register(reluctantQuant)

0 commit comments

Comments
 (0)