Skip to content

Commit 4e59e09

Browse files
Add parameterized benchmark largeSerialFormat to test parser structure formatting scalability.
1 parent 71d545d commit 4e59e09

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

benchmarks/src/jmh/kotlin/ParserStructureConcatBenchmark.kt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,30 @@ import java.util.concurrent.*
2121
@Fork(1)
2222
open class ParserStructureConcatBenchmark {
2323

24+
@Param("1", "2", "4", "8", "16")
25+
var n = 0
26+
27+
@Benchmark
28+
fun largeSerialFormat(blackhole: Blackhole) {
29+
val format = LocalDateTime.Format {
30+
repeat(n) {
31+
year()
32+
char('-')
33+
monthNumber()
34+
char('-')
35+
day()
36+
char(' ')
37+
hour()
38+
char(':')
39+
minute()
40+
char(':')
41+
second()
42+
char('_')
43+
}
44+
}
45+
blackhole.consume(format)
46+
}
47+
2448
@Benchmark
2549
fun buildPythonDateTimeFormat(blackhole: Blackhole) {
2650
val v = LocalDateTime.Format {

0 commit comments

Comments
 (0)