diff --git a/Sources/SaplingEditor/EditorPerformanceProfiling.swift b/Sources/SaplingEditor/EditorPerformanceProfiling.swift index 138e199..cdf2bf4 100644 --- a/Sources/SaplingEditor/EditorPerformanceProfiling.swift +++ b/Sources/SaplingEditor/EditorPerformanceProfiling.swift @@ -437,22 +437,27 @@ public enum EditorBenchmarkProfiler { )) let clickRenderResult = measure { - MarkdownTextStyler.apply( - to: textStorage, - invalidationPlan: dirtyClickPlan, - activeLineIndex: changedActiveLineIndex, - backgroundColor: .textBackgroundColor, - activeLineBackgroundColor: .controlAccentColor.withAlphaComponent(0.10), - textColor: .labelColor, - secondaryTextColor: .secondaryLabelColor, - accentColor: .controlAccentColor - ) + if dirtyClickPlan.requiresStyling { + return MarkdownTextStyler.apply( + to: textStorage, + invalidationPlan: dirtyClickPlan, + activeLineIndex: changedActiveLineIndex, + backgroundColor: .textBackgroundColor, + activeLineBackgroundColor: .controlAccentColor.withAlphaComponent(0.10), + textColor: .labelColor, + secondaryTextColor: .secondaryLabelColor, + accentColor: .controlAccentColor + ) + } + return MarkdownTextStylingResult.empty } measurements.append(EditorBenchmarkMeasurement( name: "render_update_click_dirty", category: .interaction, durationMilliseconds: clickRenderResult.durationMilliseconds, - notes: "\(clickRenderResult.value.styledLineCount) styled lines" + notes: dirtyClickPlan.requiresStyling + ? "\(clickRenderResult.value.styledLineCount) styled lines" + : "skipped; dirty plan did not require styling" )) let typingStorageResult = measure {