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) }