diff options
Diffstat (limited to 'Benchmarks/ParseBenchmarkTarget/ParseBenchmarkTarget.swift')
| -rw-r--r-- | Benchmarks/ParseBenchmarkTarget/ParseBenchmarkTarget.swift | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Benchmarks/ParseBenchmarkTarget/ParseBenchmarkTarget.swift b/Benchmarks/ParseBenchmarkTarget/ParseBenchmarkTarget.swift index 91e1d38..a5346f2 100644 --- a/Benchmarks/ParseBenchmarkTarget/ParseBenchmarkTarget.swift +++ b/Benchmarks/ParseBenchmarkTarget/ParseBenchmarkTarget.swift @@ -84,9 +84,20 @@ let benchmarks: @Sendable () -> Benchmark? = { } } + // Source tokenization for syntax highlighting. + Benchmark("lex example") { benchmark in + for _ in benchmark.scaledIterations { + blackHole(NorgLexer.tokenize(exampleSource)) + } + } + + Benchmark("lex huge") { benchmark in + for _ in benchmark.scaledIterations { + blackHole(NorgLexer.tokenize(hugeSource)) + } + } + // Rewriting a single status marker — the write-back path for toggling a task. - // Line 17 (zero-based) is the first task in huge.norg, so this exercises the - // full split / replace / re-join path rather than bailing out early. return Benchmark("update task status huge") { benchmark in for _ in benchmark.scaledIterations { blackHole(TaskScanner.updatedContent(hugeSource, line: 17, to: .done)) |