From 525691693b577be1ef030941ace5b1cc22b34bcc Mon Sep 17 00:00:00 2001 From: Feror Date: Sat, 30 May 2026 19:25:41 +0200 Subject: [PATCH] perf(bench): report tracked editor interaction metrics --- Sources/SaplingEditorBenchmark/main.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Sources/SaplingEditorBenchmark/main.swift b/Sources/SaplingEditorBenchmark/main.swift index b866712..58bef9c 100644 --- a/Sources/SaplingEditorBenchmark/main.swift +++ b/Sources/SaplingEditorBenchmark/main.swift @@ -86,10 +86,28 @@ func printScenario(name: String, result: EditorBenchmarkResult) { + "\(format(measurement.durationMilliseconds)) ms | \(format(percentage))% | \(measurement.notes) |") } print("") + print("Tracked interaction metrics:") + print("") + print("| Operation | Time | Notes |") + print("| --- | ---: | --- |") + for name in trackedInteractionMetricNames { + guard let measurement = result.measurements.first(where: { $0.name == name }) else { continue } + print("| `\(measurement.name)` | \(format(measurement.durationMilliseconds)) ms | \(measurement.notes) |") + } + print("") print("Measured total: \(format(result.measuredTotalMilliseconds)) ms") print("") } +let trackedInteractionMetricNames = [ + "active_line_lookup", + "selection_update", + "dirty_line_invalidation_click", + "typing_state_update", + "dirty_line_invalidation_typing", + "render_update_typing_dirty" +] + func format(_ value: Double) -> String { String(format: "%.3f", value) }